public final class UnsafeOutput extends Output
Important notes:
buffer, capacity, maxCapacity, outputStream, position, total
Constructor and Description |
---|
UnsafeOutput()
Creates an uninitialized Output.
|
UnsafeOutput(byte[] buffer)
Creates a new Output for writing to a byte array.
|
UnsafeOutput(byte[] buffer,
int maxBufferSize)
Creates a new Output for writing to a byte array.
|
UnsafeOutput(int bufferSize)
Creates a new Output for writing to a byte array.
|
UnsafeOutput(int bufferSize,
int maxBufferSize)
Creates a new Output for writing to a byte array.
|
UnsafeOutput(OutputStream outputStream)
Creates a new Output for writing to an OutputStream.
|
UnsafeOutput(OutputStream outputStream,
int bufferSize)
Creates a new Output for writing to an OutputStream.
|
Modifier and Type | Method and Description |
---|---|
boolean |
supportVarInts()
Return current setting for variable length encoding of integers
|
void |
supportVarInts(boolean supportVarInts)
Controls if a variable length encoding for integer types should be used when serializers suggest it.
|
void |
writeBytes(Object obj,
long offset,
long count)
Output count bytes from a memory region starting at the given #{offset} inside the in-memory representation of obj object.
|
void |
writeChar(char value)
Writes a 2 byte char.
|
void |
writeChars(char[] object)
Bulk output of a char array.
|
void |
writeDouble(double value)
Writes an 8 byte double.
|
void |
writeDoubles(double[] object)
Bulk output of a double array.
|
void |
writeFloat(float value)
Writes a 4 byte float.
|
void |
writeFloats(float[] object)
Bulk output of a float array.
|
void |
writeInt(int value)
Writes a 4 byte int.
|
int |
writeInt(int value,
boolean optimizePositive)
Writes a 1-5 byte int.
|
void |
writeInts(int[] object)
Bulk output of an int array.
|
void |
writeInts(int[] object,
boolean optimizePositive)
Bulk output of an int array.
|
void |
writeLong(long value)
Writes an 8 byte long.
|
int |
writeLong(long value,
boolean optimizePositive)
Writes a 1-9 byte long.
|
void |
writeLongs(long[] object)
Bulk output of an long array.
|
void |
writeLongs(long[] object,
boolean optimizePositive)
Bulk output of an long array.
|
void |
writeShort(int value)
Writes a 2 byte short.
|
void |
writeShorts(short[] object)
Bulk output of a short array.
|
int |
writeVarInt(int val,
boolean optimizePositive)
Writes a 1-5 byte int.
|
int |
writeVarLong(long value,
boolean optimizePositive)
Writes a 1-9 byte long.
|
clear, close, flush, getBuffer, getOutputStream, intLength, longLength, position, require, setBuffer, setBuffer, setOutputStream, setPosition, toBytes, total, write, write, write, writeAscii, writeBoolean, writeByte, writeByte, writeBytes, writeBytes, writeDouble, writeFloat, writeString, writeString
public UnsafeOutput()
Output.setBuffer(byte[], int)
must be called before the Output is used.public UnsafeOutput(int bufferSize)
bufferSize
- The initial and maximum size of the buffer. An exception is thrown if this size is exceeded.public UnsafeOutput(int bufferSize, int maxBufferSize)
bufferSize
- The initial size of the buffer.maxBufferSize
- The buffer is doubled as needed until it exceeds maxBufferSize and an exception is thrown.public UnsafeOutput(byte[] buffer)
Output.setBuffer(byte[])
public UnsafeOutput(byte[] buffer, int maxBufferSize)
Output.setBuffer(byte[], int)
public UnsafeOutput(OutputStream outputStream)
public UnsafeOutput(OutputStream outputStream, int bufferSize)
public final void writeInt(int value) throws KryoException
writeInt
in class Output
KryoException
public final void writeFloat(float value) throws KryoException
writeFloat
in class Output
KryoException
public final void writeShort(int value) throws KryoException
writeShort
in class Output
KryoException
public final void writeLong(long value) throws KryoException
writeLong
in class Output
KryoException
public final void writeDouble(double value) throws KryoException
writeDouble
in class Output
KryoException
public final void writeChar(char value) throws KryoException
writeChar
in class Output
KryoException
public final int writeInt(int value, boolean optimizePositive) throws KryoException
Output
writeInt
in class Output
optimizePositive
- If true, small positive numbers will be more efficient (1 byte) and small negative numbers will be
inefficient (5 bytes).KryoException
public final int writeLong(long value, boolean optimizePositive) throws KryoException
Output
writeLong
in class Output
optimizePositive
- If true, small positive numbers will be more efficient (1 byte) and small negative numbers will be
inefficient (9 bytes).KryoException
public final int writeVarInt(int val, boolean optimizePositive) throws KryoException
Output
writeVarInt
in class Output
optimizePositive
- If true, small positive numbers will be more efficient (1 byte) and small negative numbers will be
inefficient (5 bytes).KryoException
public final int writeVarLong(long value, boolean optimizePositive) throws KryoException
Output
writeVarLong
in class Output
optimizePositive
- If true, small positive numbers will be more efficient (1 byte) and small negative numbers will be
inefficient (9 bytes).KryoException
public final void writeInts(int[] object, boolean optimizePositive) throws KryoException
Output
writeInts
in class Output
KryoException
public final void writeLongs(long[] object, boolean optimizePositive) throws KryoException
Output
writeLongs
in class Output
KryoException
public final void writeInts(int[] object) throws KryoException
Output
writeInts
in class Output
KryoException
public final void writeLongs(long[] object) throws KryoException
Output
writeLongs
in class Output
KryoException
public final void writeFloats(float[] object) throws KryoException
Output
writeFloats
in class Output
KryoException
public final void writeShorts(short[] object) throws KryoException
Output
writeShorts
in class Output
KryoException
public final void writeChars(char[] object) throws KryoException
Output
writeChars
in class Output
KryoException
public final void writeDoubles(double[] object) throws KryoException
Output
writeDoubles
in class Output
KryoException
public final void writeBytes(Object obj, long offset, long count) throws KryoException
obj
- offset
- count
- KryoException
public boolean supportVarInts()
public void supportVarInts(boolean supportVarInts)
supportVarInts
- Copyright © 2018. All rights reserved.