Package com.esotericsoftware.kryo.io
Class OutputChunked
java.lang.Object
java.io.OutputStream
com.esotericsoftware.kryo.io.Output
com.esotericsoftware.kryo.io.OutputChunked
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
An OutputStream that buffers data in a byte array and flushes to another OutputStream, writing the length before each flush.
The length allows the chunks to be skipped when reading.
-
Field Summary
Fields inherited from class com.esotericsoftware.kryo.io.Output
buffer, capacity, maxCapacity, outputStream, position, total
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an uninitialized OutputChunked with a maximum chunk size of 2048.OutputChunked
(int bufferSize) Creates an uninitialized OutputChunked.OutputChunked
(OutputStream outputStream) Creates an OutputChunked with a maximum chunk size of 2048.OutputChunked
(OutputStream outputStream, int bufferSize) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Marks the end of some data that may have been written by any number of chunks.void
flush()
Writes the buffered bytes to the underlying OutputStream, if any.private void
Methods inherited from class com.esotericsoftware.kryo.io.Output
clear, close, getBuffer, getOutputStream, intLength, longLength, position, require, setBuffer, setBuffer, setOutputStream, setPosition, toBytes, total, write, write, write, writeAscii, writeBoolean, writeByte, writeByte, writeBytes, writeBytes, writeChar, writeChars, writeDouble, writeDouble, writeDoubles, writeFloat, writeFloat, writeFloats, writeInt, writeInt, writeInts, writeInts, writeLong, writeLong, writeLongs, writeLongs, writeShort, writeShorts, writeString, writeString, writeVarInt, writeVarLong
-
Constructor Details
-
OutputChunked
public OutputChunked()Creates an uninitialized OutputChunked with a maximum chunk size of 2048. The OutputStream must be set before it can be used. -
OutputChunked
public OutputChunked(int bufferSize) Creates an uninitialized OutputChunked. The OutputStream must be set before it can be used.- Parameters:
bufferSize
- The maximum size of a chunk.
-
OutputChunked
Creates an OutputChunked with a maximum chunk size of 2048. -
OutputChunked
- Parameters:
bufferSize
- The maximum size of a chunk.
-
-
Method Details
-
flush
Description copied from class:Output
Writes the buffered bytes to the underlying OutputStream, if any.- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutput
- Throws:
KryoException
-
writeChunkSize
- Throws:
IOException
-
endChunks
public void endChunks()Marks the end of some data that may have been written by any number of chunks. These chunks can then be skipped when reading.
-