|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
com.devexperts.io.BufferedInput
com.devexperts.io.StreamInput
public class StreamInput
An implementation of BufferedInput
that reads all data from source InputStream
.
Field Summary | |
---|---|
protected InputStream |
in
|
Fields inherited from class com.devexperts.io.BufferedInput |
---|
buffer, EMPTY_BYTE_ARRAY, limit, markLimit, markPosition, position, totalPositionBase |
Constructor Summary | |
---|---|
StreamInput()
Creates a new stream input with default buffer capacity. |
|
StreamInput(InputStream in)
Creates a new stream input with specified source input stream and default buffer capacity. |
|
StreamInput(InputStream in,
int size)
Creates a new stream input with specified source input stream and buffer capacity. |
|
StreamInput(int size)
Creates a new stream input with specified buffer capacity. |
Method Summary | |
---|---|
int |
available()
|
void |
close()
|
int |
read(byte[] b,
int off,
int len)
|
protected int |
readData()
This method is invoked when input methods need more bytes to read data. |
void |
resetInput()
Resets this stream input by releasing source input stream and resetting position. |
void |
rewind(long n)
Rewinds specified number of bytes. |
void |
setInput(InputStream in)
Sets new source input stream. |
long |
skip(long n)
|
Methods inherited from class com.devexperts.io.BufferedInput |
---|
checkEOB, checkRewind, mark, mark, markSupported, needData, read, read, readBoolean, readByte, readByteArray, readChar, readCompactInt, readCompactLong, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readObject, readShort, readUnsignedByte, readUnsignedShort, readUTF, readUTFChar, readUTFString, reset, seek, skipBytes, throwEOFException, totalPosition |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected InputStream in
Constructor Detail |
---|
public StreamInput()
public StreamInput(int size)
size
- the initial buffer size
IllegalArgumentException
- if size is not positivepublic StreamInput(InputStream in)
in
- the source to read frompublic StreamInput(InputStream in, int size)
in
- the source to read fromsize
- the initial buffer size
IllegalArgumentException
- if size is not positiveMethod Detail |
---|
public void setInput(InputStream in)
null
to release source.
in
- the source to read frompublic void resetInput()
public void close() throws IOException
close
in interface Closeable
close
in interface ObjectInput
close
in class InputStream
IOException
public int available() throws IOException
available
in interface ObjectInput
available
in class BufferedInput
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in interface ObjectInput
read
in class BufferedInput
IOException
public long skip(long n) throws IOException
skip
in interface ObjectInput
skip
in class BufferedInput
IOException
public void rewind(long n)
BufferedInput
rewind
in class BufferedInput
n
- the number of bytes to rewindprotected int readData() throws IOException
BufferedInput
-1
if no bytes can be read because the end of the stream has been reached.
This method may block if needed.
This method is allowed to update buffer, position, limit and totalPositionBase fields as needed.
This method shall never throw an EOFException
.
readData
in class BufferedInput
-1
if there is no more data because the end of the stream has been reached
IOException
- if an I/O error occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |