public class BytesBufferedInputStream extends AbstractBufferedInputStream
BufferedInputStream
DEFAULT_BUFFER_SIZE
in
Constructor and Description |
---|
BytesBufferedInputStream(InputStream in)
Create a new instance with the default buffer size
|
BytesBufferedInputStream(InputStream in,
int size)
Creates a new instance with the given buffer size in bytes.
|
BytesBufferedInputStream(InputStream in,
int size,
boolean useNativeByteOrder)
Creates a new instance with the given buffer size in bytes.
|
BytesBufferedInputStream(InputStream in,
int size,
ByteOrder byteOrder)
Creates a new instance with the given buffer size in bytes.
|
Modifier and Type | Method and Description |
---|---|
protected void |
assertBufferOpen() |
protected void |
clean()
Performs any necessary cleaning of the buffer and releasing of resources.
|
protected void |
compact(int markPos,
int size)
Compact the buffer reducing it to the given size, offset from the given mark position
|
protected void |
get(byte[] b,
int pos,
int cnt)
Retrieve the given number of bytes from the stream
|
protected int |
getInt(int position)
Reads four bytes (an int) from the given offset
|
protected int |
limit()
Returns the buffer's limit
|
protected void |
resizeBuffer(int position,
int newSize)
Enlarge the buffer to the new size, retaining the position
|
protected byte[] |
toArray()
Return the bytes in the buffer as a byte array
|
available, close, getMarkLimit, isRestartable, mark, markSupported, read, read, reset, restart, skip
read
public BytesBufferedInputStream(InputStream in)
in
- InputStream to be wrappedBufferedInputStream.BufferedInputStream(InputStream)
public BytesBufferedInputStream(InputStream in, int size)
in
- InputStream to be wrappedsize
- The size of the buffer in bytesBufferedInputStream.BufferedInputStream(InputStream, int)
public BytesBufferedInputStream(InputStream in, int size, boolean useNativeByteOrder)
in
- InputStream to be wrappedsize
- The size of the buffer in bytesuseNativeByteOrder
- If true, native byte ordering will be usedBufferedInputStream.BufferedInputStream(InputStream, int)
public BytesBufferedInputStream(InputStream in, int size, ByteOrder byteOrder)
in
- InputStream to be wrappedsize
- The size of the buffer in bytesbyteOrder
- Explicitly configure the byte order to be used.BufferedInputStream.BufferedInputStream(InputStream, int)
protected void assertBufferOpen() throws IOException
assertBufferOpen
in class AbstractBufferedInputStream
IOException
protected void compact(int markPos, int size)
AbstractBufferedInputStream
compact
in class AbstractBufferedInputStream
markPos
- The mark position to use as the start of the buffersize
- Required buffer sizeprotected byte[] toArray()
AbstractBufferedInputStream
toArray
in class AbstractBufferedInputStream
protected void resizeBuffer(int position, int newSize) throws IOException
AbstractBufferedInputStream
resizeBuffer
in class AbstractBufferedInputStream
position
- The positionnewSize
- The new sizeIOException
- Indicates a problem resizingprotected int limit()
AbstractBufferedInputStream
limit
in class AbstractBufferedInputStream
protected int getInt(int position) throws IOException
AbstractBufferedInputStream
getInt
in class AbstractBufferedInputStream
position
- The offsetIOException
- Indicates a problem reading the intprotected void get(byte[] b, int pos, int cnt)
AbstractBufferedInputStream
get
in class AbstractBufferedInputStream
b
- The array into which bytes will be writtenpos
- The offset within the array of the first byte to be writtencnt
- The maximum number of bytes to be written to the given arrayprotected void clean()
AbstractBufferedInputStream
clean
in class AbstractBufferedInputStream
Copyright © 2010–2018 Jadira Systems. All rights reserved.