public class UnsynchronizedByteArrayInputStream
extends java.io.InputStream
ByteArrayInputStream
which removes the synchronization overhead for non-concurrent
access; as such this class is not thread-safe.Modifier and Type | Field and Description |
---|---|
private byte[] |
data
The underlying data buffer.
|
static int |
END_OF_STREAM
The end of stream marker.
|
private int |
eod
End Of Data.
|
private int |
markedOffset
The current mark (if any).
|
private int |
offset
Current offset in the data buffer.
|
Constructor and Description |
---|
UnsynchronizedByteArrayInputStream(byte[] data)
Creates a new byte array input stream.
|
UnsynchronizedByteArrayInputStream(byte[] data,
int offset)
Creates a new byte array input stream.
|
UnsynchronizedByteArrayInputStream(byte[] data,
int offset,
int length)
Creates a new byte array input stream.
|
Modifier and Type | Method and Description |
---|---|
int |
available() |
void |
mark(int readlimit) |
boolean |
markSupported() |
int |
read() |
int |
read(byte[] dest) |
int |
read(byte[] dest,
int off,
int len) |
void |
reset() |
long |
skip(long n) |
public static final int END_OF_STREAM
private final byte[] data
private final int eod
private int offset
private int markedOffset
public UnsynchronizedByteArrayInputStream(byte[] data)
data
- the bufferpublic UnsynchronizedByteArrayInputStream(byte[] data, int offset)
data
- the bufferoffset
- the offset into the bufferjava.lang.IllegalArgumentException
- if the offset is less than zeropublic UnsynchronizedByteArrayInputStream(byte[] data, int offset, int length)
data
- the bufferoffset
- the offset into the bufferlength
- the length of the bufferjava.lang.IllegalArgumentException
- if the offset or length less than zeropublic int available()
available
in class java.io.InputStream
public int read()
read
in class java.io.InputStream
public int read(byte[] dest)
read
in class java.io.InputStream
public int read(byte[] dest, int off, int len)
read
in class java.io.InputStream
public long skip(long n)
skip
in class java.io.InputStream
public boolean markSupported()
markSupported
in class java.io.InputStream
public void mark(int readlimit)
mark
in class java.io.InputStream
public void reset()
reset
in class java.io.InputStream