|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.io.InputStream | +--java.io.ByteArrayInputStream
This class implements a buffer that can be used as an InputStream.
Field Summary | |
protected byte[] |
buf
The buffer where data is stored. |
protected int |
count
The number of characters to use in the buffer. |
protected int |
pos
The current position in the buffer. |
Constructor Summary | |
ByteArrayInputStream(byte[] buf)
Creates an ByteArrayInputStream from the specified array of bytes. |
|
ByteArrayInputStream(byte[] buf,
int offset,
int length)
Creates an ByteArrayInputStream from the specified array of bytes. |
Method Summary | |
int |
available()
Returns the number of available bytes in the buffer. |
int |
read()
Reads a byte of data. |
int |
read(byte[] b,
int off,
int len)
Reads into an array of bytes. |
void |
reset()
Resets the buffer to the beginning. |
long |
skip(long n)
Skips n bytes of input. |
Methods inherited from class java.io.InputStream |
close, mark, markSupported, read |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected byte[] buf
protected int pos
protected int count
Constructor Detail |
public ByteArrayInputStream(byte[] buf)
buf
- the input buffer (not copied)public ByteArrayInputStream(byte[] buf, int offset, int length)
buf
- the input buffer (not copied)offset
- the offset of the first byte to readlength
- the number of bytes to readMethod Detail |
public int read()
read
in class InputStream
public int read(byte[] b, int off, int len)
read
in class InputStream
b
- the buffer into which the data is readoff
- the start offset of the datalen
- the maximum number of bytes read
public long skip(long n)
skip
in class InputStream
n
- the number of bytes to be skipped
public int available()
available
in class InputStream
public void reset()
reset
in class InputStream
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |