|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
org.basex.io.in.BufferInput
public class BufferInput
This class uses an internal buffer to speed up input stream processing.
Field Summary | |
---|---|
protected int |
bpos
Current buffer position. |
protected int |
bsize
Current buffer size. |
protected byte[] |
buffer
Byte buffer. |
protected IO |
input
Input file. |
protected long |
length
Total length of input to be processed ( -1 if unknown). |
Constructor Summary | |
---|---|
protected |
BufferInput(byte[] array)
Empty constructor with fixed input. |
|
BufferInput(java.io.InputStream is)
Constructor. |
|
BufferInput(java.io.InputStream is,
int bs)
Initializes the file reader. |
|
BufferInput(IO io)
Constructor. |
Method Summary | |
---|---|
void |
close()
|
byte[] |
content()
Retrieves and returns the whole data and closes the stream. |
IO |
io()
Returns the IO reference, or null . |
long |
length()
Returns the input length (may be -1 ). |
void |
mark(int m)
|
boolean |
markSupported()
|
int |
read()
Returns the next byte. |
protected int |
readByte()
Returns the next unsigned byte. |
byte[] |
readBytes()
Reads a byte array from the input stream, suffixed by a 0 byte. |
java.lang.String |
readString()
Reads a string from the input stream, suffixed by a 0 byte. |
void |
reset()
|
int |
size()
Returns the number of read bytes. |
Methods inherited from class java.io.InputStream |
---|
available, read, read, skip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final byte[] buffer
protected int bpos
protected int bsize
protected long length
-1
if unknown).
protected IO input
Constructor Detail |
---|
public BufferInput(IO io) throws java.io.IOException
io
- input to be read
java.io.IOException
- I/O Exceptionpublic BufferInput(java.io.InputStream is)
is
- input streampublic BufferInput(java.io.InputStream is, int bs)
is
- input streambs
- buffer sizeprotected BufferInput(byte[] array)
array
- array inputMethod Detail |
---|
public IO io()
null
.
public int read() throws java.io.IOException
readByte()
;
-1
is returned if all bytes have been read.
read
in class java.io.InputStream
java.io.IOException
- I/O exceptionInputStream.read()
protected int readByte() throws java.io.IOException
-1
is returned if all bytes have been read.
java.io.IOException
- I/O exceptionInputStream.read()
public final java.lang.String readString() throws java.io.IOException
0
byte.
java.io.IOException
- I/O Exceptionpublic final byte[] readBytes() throws java.io.IOException
0
byte.
java.io.IOException
- I/O Exceptionpublic final void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.InputStream
java.io.IOException
public final int size()
public final long length()
-1
).
public final boolean markSupported()
markSupported
in class java.io.InputStream
public void mark(int m)
mark
in class java.io.InputStream
public final void reset() throws java.io.IOException
reset
in class java.io.InputStream
java.io.IOException
public byte[] content() throws java.io.IOException
java.io.IOException
- I/O exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |