Package de.undercouch.bson4jackson.io
Class UnsafeByteArrayInputStream
java.lang.Object
java.io.InputStream
de.undercouch.bson4jackson.io.UnsafeByteArrayInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
An input stream that serves the content of an array. Compared to
ByteArrayInputStream this class is not thread-safe.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionUnsafeByteArrayInputStream(byte[] buf) Creates a new stream that serves the whole given arrayUnsafeByteArrayInputStream(byte[] buf, int off, int len) Creates a new stream that serves part of the given array -
Method Summary
Methods inherited from class java.io.InputStream
nullInputStream, read, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
_buf
protected final byte[] _bufThe buffer to serve -
_pos
protected int _posThe current position in the buffer -
_count
protected int _countThe index one greater than the last byte to serve -
_mark
protected int _markThe current marked position
-
-
Constructor Details
-
UnsafeByteArrayInputStream
public UnsafeByteArrayInputStream(byte[] buf) Creates a new stream that serves the whole given array- Parameters:
buf- the array to serve
-
UnsafeByteArrayInputStream
public UnsafeByteArrayInputStream(byte[] buf, int off, int len) Creates a new stream that serves part of the given array- Parameters:
buf- the array to serveoff- the index of the first byte to servelen- the number of bytes to serve
-
-
Method Details
-
read
public int read()- Specified by:
readin classInputStream
-
read
public int read(byte[] b, int off, int len) - Overrides:
readin classInputStream
-
skip
public long skip(long n) - Overrides:
skipin classInputStream
-
available
public int available()- Overrides:
availablein classInputStream
-
markSupported
public boolean markSupported()- Overrides:
markSupportedin classInputStream
-
mark
public void mark(int readlimit) - Overrides:
markin classInputStream
-
reset
public void reset()- Overrides:
resetin classInputStream
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream
-