Class InputChunked
java.lang.Object
java.io.InputStream
com.esotericsoftware.kryo.io.Input
com.esotericsoftware.kryo.io.InputChunked
- All Implemented Interfaces:
Closeable, AutoCloseable
An InputStream that reads lengths and chunks of data from another OutputStream, allowing chunks to be skipped.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates an uninitialized InputChunked with a buffer size of 2048.InputChunked(int bufferSize) Creates an uninitialized InputChunked.InputChunked(InputStream inputStream) Creates an InputChunked with a buffer size of 2048.InputChunked(InputStream inputStream, int bufferSize) -
Method Summary
Modifier and TypeMethodDescriptionprotected intfill(byte[] buffer, int offset, int count) Fills the buffer with more bytes.voidAdvances the stream to the next set of chunks.private voidvoidrewind()Sets the position and total to zero.voidsetBuffer(byte[] bytes, int offset, int count) Sets a new buffer.voidsetInputStream(InputStream inputStream) Sets a new InputStream.Methods inherited from class Input
available, canReadInt, canReadLong, close, eof, getBuffer, getInputStream, limit, position, read, read, read, readBoolean, readByte, readBytes, readBytes, readBytes, readByteUnsigned, readChar, readChars, readDouble, readDouble, readDoubles, readFloat, readFloat, readFloats, readInt, readInt, readInts, readInts, readLong, readLong, readLongs, readLongs, readShort, readShorts, readShortUnsigned, readString, readStringBuilder, readVarInt, readVarLong, require, setBuffer, setLimit, setPosition, setTotal, skip, skip, totalMethods inherited from class InputStream
mark, markSupported, reset
-
Field Details
-
chunkSize
private int chunkSize
-
-
Constructor Details
-
InputChunked
public InputChunked()Creates an uninitialized InputChunked with a buffer size of 2048. The InputStream must be set before it can be used. -
InputChunked
public InputChunked(int bufferSize) Creates an uninitialized InputChunked. The InputStream must be set before it can be used. -
InputChunked
Creates an InputChunked with a buffer size of 2048. -
InputChunked
-
-
Method Details
-
setInputStream
Description copied from class:InputSets a new InputStream. The position and total are reset, discarding any buffered bytes.- Overrides:
setInputStreamin classInput- Parameters:
inputStream- May be null.
-
setBuffer
-
rewind
-
fill
Description copied from class:InputFills the buffer with more bytes. Can be overridden to fill the bytes from a source other than the InputStream.- Overrides:
fillin classInput- Returns:
- -1 if there are no more bytes.
- Throws:
KryoException
-
readChunkSize
private void readChunkSize() -
nextChunks
public void nextChunks()Advances the stream to the next set of chunks. InputChunked will appear to hit the end of the data until this method is called.
-