Package de.undercouch.bson4jackson.io
Class StaticBufferedInputStream
java.lang.Object
java.io.InputStream
de.undercouch.bson4jackson.io.StaticBufferedInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
Works like
BufferedInputStream, but is not thread-safe and
also uses a a re-usable static buffer provided by StaticBuffers to
achieve better performance-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ByteBufferA re-usable bufferprotected intThe number of bytes in the bufferprotected final InputStreamThe original unbuffered input streamprotected intThe current marked position.protected intThe current read positionprotected final byte[]The raw re-usable bufferprotected final StaticBuffersProvides re-usable buffersprotected static final StaticBuffers.KeyA unique key for the re-usable buffer -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new buffered input streamStaticBufferedInputStream(InputStream in, int size) Creates a new buffered input stream -
Method Summary
Methods inherited from class java.io.InputStream
available, nullInputStream, read, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
BUFFER_KEY
A unique key for the re-usable buffer -
_staticBuffers
Provides re-usable buffers -
_byteBuffer
A re-usable buffer -
_raw
protected final byte[] _rawThe raw re-usable buffer -
_in
The original unbuffered input stream -
_pos
protected int _posThe current read position -
_count
protected int _countThe number of bytes in the buffer -
_mark
protected int _markThe current marked position. -1 means no mark.
-
-
Constructor Details
-
StaticBufferedInputStream
Creates a new buffered input stream- Parameters:
in- the original unbuffered input stream
-
StaticBufferedInputStream
Creates a new buffered input stream- Parameters:
in- the original unbuffered input streamsize- the minimum buffer size
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
fill
- Throws:
IOException
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
skip
- Overrides:
skipin classInputStream- Throws:
IOException
-
markSupported
public boolean markSupported()- Overrides:
markSupportedin classInputStream
-
mark
public void mark(int marklimit) - Overrides:
markin classInputStream
-
reset
- Overrides:
resetin classInputStream- Throws:
IOException
-