Package org.apache.commons.io.input
Class UnsynchronizedByteArrayInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.apache.commons.io.input.UnsynchronizedByteArrayInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class UnsynchronizedByteArrayInputStream extends java.io.InputStream
This is an alternative toByteArrayInputStream
which removes the synchronization overhead for non-concurrent access; as such this class is not thread-safe.To build an instance, see
UnsynchronizedByteArrayInputStream.Builder
.- Since:
- 2.7
- See Also:
ByteArrayInputStream
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
UnsynchronizedByteArrayInputStream.Builder
Builds a newUnsynchronizedByteArrayInputStream
instance.
-
Field Summary
Fields Modifier and Type Field Description static int
END_OF_STREAM
The end of stream marker.
-
Constructor Summary
Constructors Constructor Description UnsynchronizedByteArrayInputStream(byte[] data)
Deprecated.UnsynchronizedByteArrayInputStream(byte[] data, int offset)
Deprecated.UnsynchronizedByteArrayInputStream(byte[] data, int offset, int length)
Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
static UnsynchronizedByteArrayInputStream.Builder
builder()
Constructs a newUnsynchronizedByteArrayInputStream.Builder
.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)
-
-
-
Field Detail
-
END_OF_STREAM
public static final int END_OF_STREAM
The end of stream marker.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
UnsynchronizedByteArrayInputStream
@Deprecated public UnsynchronizedByteArrayInputStream(byte[] data)
Deprecated.Creates a new byte array input stream.- Parameters:
data
- the buffer
-
UnsynchronizedByteArrayInputStream
@Deprecated public UnsynchronizedByteArrayInputStream(byte[] data, int offset)
Deprecated.Creates a new byte array input stream.- Parameters:
data
- the bufferoffset
- the offset into the buffer- Throws:
java.lang.IllegalArgumentException
- if the offset is less than zero
-
UnsynchronizedByteArrayInputStream
@Deprecated public UnsynchronizedByteArrayInputStream(byte[] data, int offset, int length)
Deprecated.Creates a new byte array input stream.- Parameters:
data
- the bufferoffset
- the offset into the bufferlength
- the length of the buffer- Throws:
java.lang.IllegalArgumentException
- if the offset or length less than zero
-
-
Method Detail
-
builder
public static UnsynchronizedByteArrayInputStream.Builder builder()
Constructs a newUnsynchronizedByteArrayInputStream.Builder
.- Returns:
- a new
UnsynchronizedByteArrayInputStream.Builder
.
-
available
public int available()
- Overrides:
available
in classjava.io.InputStream
-
mark
public void mark(int readlimit)
- Overrides:
mark
in classjava.io.InputStream
-
markSupported
public boolean markSupported()
- Overrides:
markSupported
in classjava.io.InputStream
-
read
public int read()
- Specified by:
read
in classjava.io.InputStream
-
read
public int read(byte[] dest)
- Overrides:
read
in classjava.io.InputStream
-
read
public int read(byte[] dest, int off, int len)
- Overrides:
read
in classjava.io.InputStream
-
reset
public void reset()
- Overrides:
reset
in classjava.io.InputStream
-
skip
public long skip(long n)
- Overrides:
skip
in classjava.io.InputStream
-
-