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 BinaryInputpublic int getAvailable()
throws java.io.IOException
getAvailable in interface BinaryInputjava.io.IOExceptionpublic BinaryInput openCopy() throws java.io.IOException
openCopy in interface BinaryInputjava.io.IOExceptionpublic void setEncoding(java.lang.String encoding)
throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingExceptionpublic void unread()
throws java.io.IOException
unread in interface BinaryInputjava.io.IOExceptionpublic int read()
throws java.io.IOException
read in interface BinaryInputjava.io.IOExceptionpublic int read(byte[] buffer,
int offset,
int length)
throws java.io.IOException
read in interface BinaryInputjava.io.IOExceptionpublic int read(char[] buffer,
int offset,
int length)
throws java.io.IOException
java.io.IOExceptionpublic StringValue read(int length) throws java.io.IOException
read in interface BinaryInputjava.io.IOExceptionpublic boolean readOptionalLinefeed()
throws java.io.IOException
readOptionalLinefeed in interface BinaryInputjava.io.IOExceptionpublic void writeToStream(java.io.OutputStream os,
int length)
throws java.io.IOException
java.io.IOExceptionpublic StringValue readLine(long length) throws java.io.IOException
readLine in interface BinaryInputjava.io.IOExceptionpublic StringValue appendTo(StringValue builder) throws java.io.IOException
appendTo in interface BinaryInputjava.io.IOExceptionpublic boolean isEOF()
isEOF in interface BinaryStreampublic long getPosition()
getPosition in interface BinaryInputgetPosition in interface BinaryStreampublic boolean setPosition(long offset)
setPosition in interface BinaryInputsetPosition in interface BinaryStreampublic long seek(long offset,
int whence)
BinaryStreamseek in interface BinaryStreampublic Value stat()
BinaryStreamstat in interface BinaryStreampublic void closeRead()
closeRead in interface BinaryInputpublic java.lang.Object toJavaObject()
public java.lang.String getResourceType()
protected Env getEnv()
public void close()
close in interface BinaryInputclose in interface BinaryStreampublic java.lang.String toString()
toString in class java.lang.Object