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:
java.io.Closeable
,java.lang.AutoCloseable
public class InputChunked extends Input
An InputStream that reads lengths and chunks of data from another OutputStream, allowing chunks to be skipped.
-
-
Constructor Summary
Constructors Constructor Description InputChunked()
Creates an uninitialized InputChunked with a buffer size of 2048.InputChunked(int bufferSize)
Creates an uninitialized InputChunked.InputChunked(java.io.InputStream inputStream)
Creates an InputChunked with a buffer size of 2048.InputChunked(java.io.InputStream inputStream, int bufferSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
fill(byte[] buffer, int offset, int count)
Fills the buffer with more bytes.void
nextChunks()
Advances the stream to the next set of chunks.void
rewind()
Sets the position and total to zero.void
setBuffer(byte[] bytes, int offset, int count)
Sets a new buffer.void
setInputStream(java.io.InputStream inputStream)
Sets a new InputStream.-
Methods inherited from class com.esotericsoftware.kryo.io.Input
canReadInt, canReadLong, close, getBuffer, getInputStream, limit, position, read, read, read, readBoolean, readByte, readBytes, readBytes, readBytes, readByteUnsigned, readChar, readDouble, readDouble, readFloat, readFloat, readInt, readInt, readLong, readLong, readShort, readShortUnsigned, readString, readStringBuilder, setBuffer, setLimit, setPosition, setTotal, skip, skip, total
-
-
-
-
Constructor Detail
-
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
public InputChunked(java.io.InputStream inputStream)
Creates an InputChunked with a buffer size of 2048.
-
InputChunked
public InputChunked(java.io.InputStream inputStream, int bufferSize)
-
-
Method Detail
-
setInputStream
public void setInputStream(java.io.InputStream inputStream)
Description copied from class:Input
Sets a new InputStream. The position and total are reset, discarding any buffered bytes.- Overrides:
setInputStream
in classInput
- Parameters:
inputStream
- May be null.
-
setBuffer
public void setBuffer(byte[] bytes, int offset, int count)
Description copied from class:Input
Sets a new buffer. The position and total are reset, discarding any buffered bytes.
-
rewind
public void rewind()
Description copied from class:Input
Sets the position and total to zero.
-
fill
protected int fill(byte[] buffer, int offset, int count) throws KryoException
Description copied from class:Input
Fills the buffer with more bytes. Can be overridden to fill the bytes from a source other than the InputStream.- Overrides:
fill
in classInput
- Throws:
KryoException
-
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.
-
-