Package org.apache.commons.io.input
Class UnsynchronizedByteArrayInputStream
java.lang.Object
java.io.InputStream
org.apache.commons.io.input.UnsynchronizedByteArrayInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
This is an alternative to
ByteArrayInputStream
which removes the synchronization overhead for non-concurrent
access; as such this class is not thread-safe.- Since:
- 2.7
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionUnsynchronizedByteArrayInputStream
(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. -
Method Summary
Methods inherited from class java.io.InputStream
close, nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
END_OF_STREAM
The end of stream marker.- See Also:
-
-
Constructor Details
-
UnsynchronizedByteArrayInputStream
Creates a new byte array input stream.- Parameters:
data
- the buffer
-
UnsynchronizedByteArrayInputStream
Creates a new byte array input stream.- Parameters:
data
- the bufferoffset
- the offset into the buffer- Throws:
IllegalArgumentException
- if the offset is less than zero
-
UnsynchronizedByteArrayInputStream
Creates a new byte array input stream.- Parameters:
data
- the bufferoffset
- the offset into the bufferlength
- the length of the buffer- Throws:
IllegalArgumentException
- if the offset or length less than zero
-
-
Method Details
-
available
- Overrides:
available
in classInputStream
-
read
- Specified by:
read
in classInputStream
-
read
- Overrides:
read
in classInputStream
-
read
- Overrides:
read
in classInputStream
-
skip
- Overrides:
skip
in classInputStream
-
markSupported
- Overrides:
markSupported
in classInputStream
-
mark
- Overrides:
mark
in classInputStream
-
reset
- Overrides:
reset
in classInputStream
-