|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.InputStream
java.io.ByteArrayInputStream
public class ByteArrayInputStream
ByteArrayInputStream is used for streaming over a byte array.
ByteArrayOutputStream| Field Summary | |
|---|---|
protected byte[] |
buf
The byte array containing the bytes to stream over. |
protected int |
count
The total number of bytes initially available in the byte array buf. |
protected int |
mark
The current mark position. |
protected int |
pos
The current position within the byte array. |
| Constructor Summary | |
|---|---|
ByteArrayInputStream(byte[] buf)
Constructs a new ByteArrayInputStream on the byte array buf. |
|
ByteArrayInputStream(byte[] buf,
int offset,
int length)
Constructs a new ByteArrayInputStream on the byte array buf
with the position set to offset and the number of bytes
available set to offset + length. |
|
| Method Summary | |
|---|---|
int |
available()
Answers a int representing then number of bytes that are available before this ByteArrayInputStream will block. |
void |
close()
Close the ByteArrayInputStream. |
int |
read()
Reads a single byte from this ByteArrayInputStream and returns the result as an int. |
int |
read(byte[] b,
int offset,
int length)
Reads at most len bytes from this ByteArrayInputStream and
stores them in byte array b starting at offset
off. |
long |
skip(long n)
Skips count number of bytes in this InputStream. |
| Methods inherited from class java.io.InputStream |
|---|
mark, markSupported, read, reset |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, println, toString |
| Field Detail |
|---|
protected byte[] buf
byte array containing the bytes to stream over.
protected int pos
protected int mark
offset
parameter within the constructor.
protected int count
buf.
| Constructor Detail |
|---|
public ByteArrayInputStream(byte[] buf)
buf.
buf - the byte array to stream over
public ByteArrayInputStream(byte[] buf,
int offset,
int length)
buf
with the position set to offset and the number of bytes
available set to offset + length.
buf - the byte array to stream overoffset - the offset in buf to start streaming atlength - the number of bytes available to stream over.| Method Detail |
|---|
public int available()
available in class InputStream
public void close()
throws IOException
close in class InputStreamIOException - If an error occurs attempting to close this InputStream.public int read()
read in class InputStream
public int read(byte[] b,
int offset,
int length)
len bytes from this ByteArrayInputStream and
stores them in byte array b starting at offset
off. Answer the number of bytes actually read or -1 if no
bytes were read and end of stream was encountered. This implementation
reads bytes from the target byte array.
read in class InputStreamb - the byte array in which to store the read bytes.offset - the offset in b to store the read bytes.length - the maximum number of bytes to store in b.
public long skip(long n)
count number of bytes in this InputStream.
Subsequent read()'s will not return these bytes unless
reset() is used. This implementation skips
count number of bytes in the target stream.
skip in class InputStreamn - the number of bytes to skip.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||