public final class ChunkedInput extends BufferedInput
BufferedInput using ChunkList as an input.buffer, EMPTY_BYTE_ARRAY, limit, markPosition, position, totalPositionBase| Constructor and Description |
|---|
ChunkedInput()
Constructs new chunked input with
default pool. |
ChunkedInput(ChunkPool pool)
Constructs new chunked input with a specified pool to acquire chunk list from..
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAllToInput(ChunkList chunkList,
Object owner)
Adds specified chunks to the input.
|
void |
addToInput(byte[] bytes,
int offset,
int length)
Adds specified bytes to the input.
|
void |
addToInput(Chunk chunk,
Object owner)
Adds specified chunk to the input.
|
int |
available()
Returns the number of bytes that can be read without blocking.
|
void |
clear()
Clears this chunked input, invalidates the mark and recycles all contained chunks.
|
boolean |
hasAvailable()
Checks if more bytes can be read from this input.
|
boolean |
hasAvailable(int bytes)
Checks if the specified number of bytes can be read from this input.
|
void |
mark()
Marks the current position in this buffered input.
|
int |
read(byte[] b,
int off,
int len) |
protected int |
readData()
This method is invoked when input methods need more bytes to read data.
|
void |
rewind(long n)
Rewinds specified number of bytes.
|
String |
toString()
Returns a string representation of the object.
|
void |
unmark()
Invalidates
mark position in this buffered input. |
checkEncapsulatedLength, checkEOB, checkRewind, mark, mark, markSupported, needData, read, read, readBoolean, readByte, readByteArray, readChar, readCompactInt, readCompactLong, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readMarshalled, readMarshalled, readObject, readObject, readObject, readProperties, readShort, readToByteBuffer, readToDataOutput, readToOutputStream, readUnsignedByte, readUnsignedShort, readUTF, readUTFBody, readUTFChar, readUTFString, reset, seek, skip, skipBytes, throwEOFException, totalPositioncloseclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitclosepublic ChunkedInput()
default pool.public ChunkedInput(ChunkPool pool)
public void clear()
totalPosition is reset to 0.public void addToInput(byte[] bytes,
int offset,
int length)
bytes - the bytes.offset - offset in the bytes.length - the length.public void addToInput(Chunk chunk, Object owner)
chunk - the chunk to be addedowner - owner of the chunkIllegalStateException - if the given chunk is not read-only and its owner differs from the one specifiedpublic void addAllToInput(ChunkList chunkList, Object owner)
chunkList - the chunk list with chunks to be addedowner - owner of the chunksIllegalStateException - if the given chunk is not read-only and its owner differs from the one specifiedpublic boolean hasAvailable()
available() > 0 check.
This implementation returns
hasAvailable(1)hasAvailable in class BufferedInputtrue if more bytes can be read from this input.public boolean hasAvailable(int bytes)
available() >= bytes check.
This implementation returns
available() >= byteshasAvailable in class BufferedInputbytes - the number of bytes.true if the specified number of bytes can be read from this input.public int available()
available in interface ObjectInputavailable in class BufferedInputpublic int read(byte[] b,
int off,
int len)
read in interface ObjectInputread in class BufferedInputpublic void mark()
reset method repositions this input at the last marked
position so that subsequent reads re-read the same bytes.
A subsequent call to unmark method invalidates mark
without changing input position.mark in class BufferedInputpublic void unmark()
mark position in this buffered input.
This method does nothing is this input was not marked.unmark in class BufferedInputpublic void rewind(long n)
throws IllegalStateException
rewind in class BufferedInputn - the number of bytes to rewindIllegalStateException - if this stream is not marked or if attempting to rewind past the marked positionpublic String toString()
protected int readData()
BufferedInput-1
if no bytes can be read because the end of the stream has been reached.
This method may block if needed.
This method is allowed to update buffer, position, limit and totalPositionBase fields as needed.
This method shall never throw an EOFException.
readData in class BufferedInput-1 if there is no more data because the end of the stream has been reachedCopyright © 2002–2025 Devexperts LLC. All rights reserved.