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.
|
read
protected 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 InputStream
public void close() throws IOException
close
in interface AutoCloseable
close
in class InputStream
IOException
public void mark(int readAheadLimit)
mark
in class InputStream
public boolean markSupported()
markSupported
in class InputStream
public int read()
read
in class InputStream
public int read(byte[] b, int off, int len)
read
in class InputStream
public void reset()
reset
in class InputStream
public long skip(long n)
skip
in class InputStream