|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
org.eclipse.ercp.xml.io.SimpleBufferedInputStream
public class SimpleBufferedInputStream
Simplified version of a BufferedInputStream allowing to rewind read bytes by providing them!
Constructor Summary | |
---|---|
SimpleBufferedInputStream(java.io.InputStream in)
Constructor for SimpleBufferedInputStream. |
Method Summary | |
---|---|
int |
available()
Answers a int representing then number of bytes that are available before this InputStream will block. |
void |
close()
Close the InputStream. |
int |
read()
Reads a single byte from this InputStream and returns the result as an int. |
int |
read(byte[] buffer,
int offset,
int length)
Reads at most length bytes from this InputStream and stores them in byte
array buffer starting at offset offset . |
long |
skip(long amount)
Skips amount number of bytes in this BufferedInputStream. |
void |
unread(byte[] bytes,
int length)
Restore a set of bytes in the buffer |
Methods inherited from class java.io.InputStream |
---|
mark, markSupported, read, reset |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SimpleBufferedInputStream(java.io.InputStream in) throws java.io.IOException
java.io.IOException
Method Detail |
---|
public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
- If the stream is already closed or another IOException occurs.public int read(byte[] buffer, int offset, int length) throws java.io.IOException
length
bytes from this InputStream and stores them in byte
array buffer
starting at offset offset
. Answer the number of bytes
actually read or -1 if no bytes were read and end of stream was encountered. If all the
buffered bytes have been used, a mark has not been set, and the requested number
of bytes is larger than the receiver's buffer size, this implementation bypasses
the buffer and simply places the results directly into buffer
.
read
in class java.io.InputStream
buffer
- the byte array in which to store the read bytes.offset
- the offset in buffer
to store the read bytes.length
- the maximum number of bytes to store in buffer
.
java.io.IOException
- If the stream is already closed or another IOException occurs.public void unread(byte[] bytes, int length)
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.InputStream
java.io.IOException
- If an error occurs attempting to close this InputStream.public int available() throws java.io.IOException
available
in class java.io.InputStream
java.io.IOException
- If an error occurs in this InputStream.public long skip(long amount) throws java.io.IOException
amount
number of bytes in this BufferedInputStream. Subsequent
read()
's will not return these bytes unless reset()
is used.
skip
in class java.io.InputStream
amount
- the number of bytes to skip.
java.io.IOException
- If the stream is already closed or another IOException occurs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |