Package com.esotericsoftware.kryo.io
Class InputChunked
- java.lang.Object
-
- java.io.InputStream
-
- com.esotericsoftware.kryo.io.Input
-
- com.esotericsoftware.kryo.io.InputChunked
-
- All Implemented Interfaces:
Pool.Poolable,Closeable,AutoCloseable
public class InputChunked extends Input
AnInputthat reads lengths and chunks of data from another OutputStream, allowing chunks to be skipped.- Author:
- Nathan Sweet
-
-
Field Summary
-
Fields inherited from class com.esotericsoftware.kryo.io.Input
buffer, capacity, chars, inputStream, limit, position, total, varEncoding
-
-
Constructor Summary
Constructors Constructor Description InputChunked()InputChunked(int bufferSize)InputChunked(InputStream inputStream)InputChunked(InputStream inputStream, int bufferSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected intfill(byte[] buffer, int offset, int count)Fills the buffer with more bytes.voidnextChunk()Advances the stream to the next chunk.voidreset()Sets the position and total to zero.voidsetBuffer(byte[] bytes, int offset, int count)Sets a new buffer to read from.voidsetInputStream(InputStream inputStream)Sets an InputStream to read from when data in the buffer is exhausted.-
Methods inherited from class com.esotericsoftware.kryo.io.Input
available, canReadInt, canReadLong, canReadVarInt, canReadVarLong, close, end, getBuffer, getInputStream, getVariableLengthEncoding, limit, optional, position, read, read, read, readBoolean, readBooleans, readByte, readBytes, readBytes, readBytes, readByteUnsigned, readChar, readChars, readDouble, readDoubles, readFloat, readFloats, readInt, readInt, readInt, readInts, readInts, readLong, readLong, readLong, readLongs, readLongs, readShort, readShorts, readShortUnsigned, readString, readStringBuilder, readVarDouble, readVarFloat, readVarInt, readVarIntFlag, readVarIntFlag, readVarLong, require, setBuffer, setLimit, setPosition, setTotal, setVariableLengthEncoding, skip, skip, total
-
Methods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Constructor Detail
-
InputChunked
public InputChunked()
- See Also:
Input()
-
InputChunked
public InputChunked(int bufferSize)
- See Also:
Input(int)
-
InputChunked
public InputChunked(InputStream inputStream)
- See Also:
Input(InputStream)
-
InputChunked
public InputChunked(InputStream inputStream, int bufferSize)
- See Also:
Input(InputStream, int)
-
-
Method Detail
-
setInputStream
public void setInputStream(InputStream inputStream)
Description copied from class:InputSets an InputStream to read from when data in the buffer is exhausted. The position, limit, and total are reset, discarding any buffered bytes.- Overrides:
setInputStreamin classInput- Parameters:
inputStream- May be null.
-
setBuffer
public void setBuffer(byte[] bytes, int offset, int count)Description copied from class:InputSets a new buffer to read from. The bytes are not copied, the old buffer is discarded and the new buffer used in its place. The position and total are reset. TheInputStreamis set to null.
-
reset
public void reset()
Description copied from class:InputSets the position and total to zero.- Specified by:
resetin interfacePool.Poolable- Overrides:
resetin classInput
-
fill
protected int fill(byte[] buffer, int offset, int count) throws KryoExceptionDescription copied from class:InputFills the buffer with more bytes. The default implementation reads from theInputStream, if set. Can be overridden to fill the bytes from another source.- Overrides:
fillin classInput- Returns:
- -1 if there are no more bytes.
- Throws:
KryoException
-
nextChunk
public void nextChunk()
Advances the stream to the next chunk. InputChunked will appear to hit the end of the data until this method is called.
-
-