public class ReadStreamInput extends java.io.InputStream implements BinaryInput
SEEK_CUR, SEEK_END, SEEK_SET
Modifier | Constructor and Description |
---|---|
|
ReadStreamInput(Env env) |
|
ReadStreamInput(Env env,
java.io.InputStream is) |
protected |
ReadStreamInput(Env env,
LineReader lineReader) |
protected |
ReadStreamInput(Env env,
LineReader lineReader,
ReadStream is) |
Modifier and Type | Method and Description |
---|---|
StringValue |
appendTo(StringValue builder)
Appends to a string builder.
|
void |
close()
Closes the file.
|
void |
closeRead()
Closes the stream for reading.
|
int |
getAvailable() |
java.io.InputStream |
getInputStream()
Returns the input stream.
|
long |
getPosition()
Returns the current location in the file.
|
java.lang.String |
getResourceType() |
void |
init(ReadStream is) |
boolean |
isEOF()
Returns true on the EOF.
|
BinaryInput |
openCopy()
Opens a copy.
|
int |
read()
Reads a character from a file, returning -1 on EOF.
|
int |
read(byte[] buffer,
int offset,
int length)
Reads a buffer from a file, returning -1 on EOF.
|
int |
read(char[] buffer,
int offset,
int length)
Reads a buffer from a file, returning -1 on EOF.
|
StringValue |
read(int length)
Reads into a binary builder.
|
StringValue |
readLine(long length)
Reads a line from a file, returning null on EOF.
|
boolean |
readOptionalLinefeed()
Reads the optional linefeed character from a \r\n
|
long |
seek(long offset,
int whence)
Seek according to offset and whence.
|
void |
setEncoding(java.lang.String encoding) |
boolean |
setPosition(long offset)
Returns the current location in the file.
|
Value |
stat()
Returns an array filled with stat information.
|
java.lang.Object |
toJavaObject() |
java.lang.String |
toString()
Converts to a string.
|
void |
unread()
Unreads the last byte.
|
void |
writeToStream(java.io.OutputStream os,
int length) |
public ReadStreamInput(Env env)
public ReadStreamInput(Env env, java.io.InputStream is)
protected ReadStreamInput(Env env, LineReader lineReader)
protected ReadStreamInput(Env env, LineReader lineReader, ReadStream is)
public void init(ReadStream is)
public java.io.InputStream getInputStream()
getInputStream
in interface BinaryInput
public BinaryInput openCopy() throws java.io.IOException
openCopy
in interface BinaryInput
java.io.IOException
public void setEncoding(java.lang.String encoding) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
public void unread() throws java.io.IOException
BinaryInput
unread
in interface BinaryInput
java.io.IOException
public int getAvailable() throws java.io.IOException
getAvailable
in interface BinaryInput
java.io.IOException
public int read() throws java.io.IOException
read
in interface BinaryInput
read
in class java.io.InputStream
java.io.IOException
public int read(byte[] buffer, int offset, int length) throws java.io.IOException
read
in interface BinaryInput
read
in class java.io.InputStream
java.io.IOException
public int read(char[] buffer, int offset, int length) throws java.io.IOException
java.io.IOException
public StringValue read(int length) throws java.io.IOException
read
in interface BinaryInput
java.io.IOException
public boolean readOptionalLinefeed() throws java.io.IOException
readOptionalLinefeed
in interface BinaryInput
java.io.IOException
public void writeToStream(java.io.OutputStream os, int length) throws java.io.IOException
java.io.IOException
public StringValue appendTo(StringValue builder)
appendTo
in interface BinaryInput
public StringValue readLine(long length) throws java.io.IOException
readLine
in interface BinaryInput
java.io.IOException
public boolean isEOF()
isEOF
in interface BinaryStream
public long getPosition()
getPosition
in interface BinaryInput
getPosition
in interface BinaryStream
public boolean setPosition(long offset)
setPosition
in interface BinaryInput
setPosition
in interface BinaryStream
public long seek(long offset, int whence)
BinaryStream
seek
in interface BinaryStream
public Value stat()
BinaryStream
stat
in interface BinaryStream
public void closeRead()
closeRead
in interface BinaryInput
public void close()
close
in interface BinaryInput
close
in interface BinaryStream
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.InputStream
public java.lang.Object toJavaObject()
public java.lang.String getResourceType()
public java.lang.String toString()
toString
in class java.lang.Object