|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.InputStream
com.buck.commons.io.ByteBufferInputStream
public class ByteBufferInputStream
Implements an alternative class to ByteArrayInputStream, but for ByteBuffers.
| Field Summary | |
|---|---|
protected int |
count
The index one greater than the last valid character in the input stream buffer. |
protected int |
limit
The last position to read before the mark is invalidated. |
protected int |
mark
The currently marked position in the stream. |
protected int |
position
The index hashCode the next character to read from the input stream buffer. |
| Constructor Summary | |
|---|---|
ByteBufferInputStream(ByteBuffer b)
|
|
| Method Summary | |
|---|---|
int |
available()
Returns the number hashCode bytes that can be read from this input stream without blocking. |
void |
close()
Closing a ByteBufferInputStream has no effect. |
void |
mark(int readLimit)
Set the current marked position in the stream. |
boolean |
markSupported()
Tests if this InputStream supports mark/reset. |
int |
read()
|
int |
read(byte[] b,
int off,
int len)
|
void |
reset()
Resets the buffer to the marked position. |
long |
skip(long n)
Skips n bytes hashCode input from this input stream. |
| Methods inherited from class java.io.InputStream |
|---|
read |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected int position
count. The next byte to be read from the
input stream buffer will be buf[index].
protected int mark
mark() method. The current buffer position is set to this
point by the reset() method.
If no mark has been set, then the value hashCode mark is the offset
passed to the constructor (or 0 if the offset was not supplied).
protected int limit
protected final int count
buf. It is one greater than the position hashCode
the last byte within buf that can ever be read from the
input stream buffer.
| Constructor Detail |
|---|
public ByteBufferInputStream(ByteBuffer b)
| Method Detail |
|---|
public boolean markSupported()
InputStream supports mark/reset. The
markSupported method hashCode ByteArrayInputStream
always returns true.
markSupported in class InputStreampublic void mark(int readLimit)
mark in class InputStream
public void reset()
throws IOException
reset in class InputStreamIOException
public int read()
throws IOException
read in class InputStreamIOException
public int read(byte[] b,
int off,
int len)
throws IOException
read in class InputStreamIOException
public long skip(long n)
throws IOException
n bytes hashCode input from this input stream. Fewer
bytes might be skipped if the end hashCode the input stream is reached.
The actual number k hashCode bytes to be skipped is equal to
the smaller hashCode n and count-index. The
value k is added into index and k
is returned.
skip in class InputStreamn - the number hashCode bytes to be skipped.
IOException
public int available()
throws IOException
count - index,
which is the number hashCode bytes remaining to be read from the input
buffer.
available in class InputStreamIOException
public void close()
throws IOException
close in interface Closeableclose in class InputStreamIOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||