public class AbstractBinaryInput extends java.lang.Object implements BinaryInput
SEEK_CUR, SEEK_END, SEEK_SET
Modifier | Constructor and Description |
---|---|
protected |
AbstractBinaryInput(Env env) |
protected |
AbstractBinaryInput(Env env,
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() |
protected Env |
getEnv() |
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)
Sets 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()
Unread the last byte.
|
void |
writeToStream(java.io.OutputStream os,
int length) |
protected AbstractBinaryInput(Env env)
protected AbstractBinaryInput(Env env, ReadStream is)
public void init(ReadStream is)
public java.io.InputStream getInputStream()
getInputStream
in interface BinaryInput
public int getAvailable() throws java.io.IOException
getAvailable
in interface BinaryInput
java.io.IOException
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
unread
in interface BinaryInput
java.io.IOException
public int read() throws java.io.IOException
read
in interface BinaryInput
java.io.IOException
public int read(byte[] buffer, int offset, int length) throws java.io.IOException
read
in interface BinaryInput
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 readLine(long length) throws java.io.IOException
readLine
in interface BinaryInput
java.io.IOException
public StringValue appendTo(StringValue builder) throws java.io.IOException
appendTo
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 java.lang.Object toJavaObject()
public java.lang.String getResourceType()
protected Env getEnv()
public void close()
close
in interface BinaryInput
close
in interface BinaryStream
public java.lang.String toString()
toString
in class java.lang.Object