public final class UnsafeOutput extends Output
Important notes:
| Modifier and Type | Field and Description |
|---|---|
private static boolean |
isLittleEndian |
private boolean |
supportVarInts
If set, variable length encoding will be set for integer types if it is required
|
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(java.io.OutputStream outputStream)
Creates a new Output for writing to an OutputStream.
|
UnsafeOutput(java.io.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(java.lang.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.
|
private void |
writeBytes(java.lang.Object srcArray,
long srcArrayTypeOffset,
long srcOffset,
long count) |
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.
|
private void |
writeLittleEndianInt(int val) |
private void |
writeLittleEndianLong(long val) |
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, writeStringprivate boolean supportVarInts
private static final boolean isLittleEndian
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(java.io.OutputStream outputStream)
public UnsafeOutput(java.io.OutputStream outputStream,
int bufferSize)
public final void writeInt(int value)
throws KryoException
writeInt in class OutputKryoExceptionprivate final void writeLittleEndianInt(int val)
public final void writeFloat(float value)
throws KryoException
writeFloat in class OutputKryoExceptionpublic final void writeShort(int value)
throws KryoException
writeShort in class OutputKryoExceptionpublic final void writeLong(long value)
throws KryoException
writeLong in class OutputKryoExceptionprivate final void writeLittleEndianLong(long val)
public final void writeDouble(double value)
throws KryoException
writeDouble in class OutputKryoExceptionpublic final void writeChar(char value)
throws KryoException
writeChar in class OutputKryoExceptionpublic final int writeInt(int value,
boolean optimizePositive)
throws KryoException
OutputwriteInt in class OutputoptimizePositive - If true, small positive numbers will be more efficient (1 byte) and small negative numbers will be
inefficient (5 bytes).KryoExceptionpublic final int writeLong(long value,
boolean optimizePositive)
throws KryoException
OutputwriteLong in class OutputoptimizePositive - If true, small positive numbers will be more efficient (1 byte) and small negative numbers will be
inefficient (9 bytes).KryoExceptionpublic final int writeVarInt(int val,
boolean optimizePositive)
throws KryoException
OutputwriteVarInt in class OutputoptimizePositive - If true, small positive numbers will be more efficient (1 byte) and small negative numbers will be
inefficient (5 bytes).KryoExceptionpublic final int writeVarLong(long value,
boolean optimizePositive)
throws KryoException
OutputwriteVarLong in class OutputoptimizePositive - If true, small positive numbers will be more efficient (1 byte) and small negative numbers will be
inefficient (9 bytes).KryoExceptionpublic final void writeInts(int[] object,
boolean optimizePositive)
throws KryoException
OutputwriteInts in class OutputKryoExceptionpublic final void writeLongs(long[] object,
boolean optimizePositive)
throws KryoException
OutputwriteLongs in class OutputKryoExceptionpublic final void writeInts(int[] object)
throws KryoException
OutputwriteInts in class OutputKryoExceptionpublic final void writeLongs(long[] object)
throws KryoException
OutputwriteLongs in class OutputKryoExceptionpublic final void writeFloats(float[] object)
throws KryoException
OutputwriteFloats in class OutputKryoExceptionpublic final void writeShorts(short[] object)
throws KryoException
OutputwriteShorts in class OutputKryoExceptionpublic final void writeChars(char[] object)
throws KryoException
OutputwriteChars in class OutputKryoExceptionpublic final void writeDoubles(double[] object)
throws KryoException
OutputwriteDoubles in class OutputKryoExceptionpublic final void writeBytes(java.lang.Object obj,
long offset,
long count)
throws KryoException
obj - offset - count - KryoExceptionprivate final void writeBytes(java.lang.Object srcArray,
long srcArrayTypeOffset,
long srcOffset,
long count)
throws KryoException
KryoExceptionpublic boolean supportVarInts()
public void supportVarInts(boolean supportVarInts)
supportVarInts -