public class ByteArrayInputStream extends InputStream
| Modifier and Type | Field and Description |
|---|---|
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 and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
readprotected byte[] buf
protected int count
protected int mark
protected int pos
public ByteArrayInputStream(byte[] buf)
public ByteArrayInputStream(byte[] buf,
int offset,
int length)
public int available()
available in class InputStreampublic void close()
throws IOException
close in interface AutoCloseableclose in class InputStreamIOExceptionpublic void mark(int readAheadLimit)
mark in class InputStreampublic boolean markSupported()
markSupported in class InputStreampublic int read()
read in class InputStreampublic 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