|
||||||||||
| 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
A ByteArrayInputStream contains an internal buffer that contains bytes that may be read from the stream. An internal counter keeps track of the next byte to be supplied by the read method.
| Field Summary | |
|---|---|
protected byte[] |
buf
An array of bytes that was provided by the creator of the stream. |
protected int |
count
The index one greater than the last valid character in the input stream buffer. |
protected int |
mark
The currently marked position in the stream. |
protected int |
pos
The index of the next character to read from the input stream buffer. |
| Constructor Summary | |
|---|---|
ByteArrayInputStream(byte[] buf)
Creates a ByteArrayInputStream so that it uses buf as its buffer array. |
|
ByteArrayInputStream(byte[] buf,
int offset,
int length)
Creates ByteArrayInputStream that uses buf as its buffer array. |
|
| Method Summary | |
|---|---|
int |
available()
Returns the number of bytes that can be read from this input stream without blocking. |
void |
close()
Closes this input stream and releases any system resources associated with the stream. |
void |
mark(int readAheadLimit)
Set the current marked position in the stream. |
boolean |
markSupported()
Tests if ByteArrayInputStream supports mark/reset. |
int |
read()
Reads the next byte of data from this input stream. |
int |
read(byte[] b,
int off,
int len)
Reads up to len bytes of data into an array of bytes from this input stream. |
void |
reset()
Resets the buffer to the marked position. |
long |
skip(long n)
Skips n bytes of input from this input stream. |
| Methods inherited from class java.io.InputStream |
|---|
read |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected byte[] buf
protected int count
protected int mark
protected int pos
| Constructor Detail |
|---|
public ByteArrayInputStream(byte[] buf)
public ByteArrayInputStream(byte[] buf,
int offset,
int length)
| Method Detail |
|---|
public int available()
available in class InputStream
public void close()
throws IOException
close in class InputStreamIOExceptionpublic void mark(int readAheadLimit)
mark in class InputStreampublic boolean markSupported()
markSupported in class InputStreampublic int read()
read in class InputStream
public int read(byte[] b,
int off,
int len)
read in class InputStreampublic void reset()
reset in class InputStreampublic long skip(long n)
skip in class InputStream
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||