public final class UnsafeMemoryOutput extends ByteBufferOutput
Important notes:
nativeOrder, niobuffer, varIntsEnabledbuffer, capacity, maxCapacity, outputStream, position, total| Constructor and Description |
|---|
UnsafeMemoryOutput()
Creates an uninitialized Output.
|
UnsafeMemoryOutput(int bufferSize)
Creates a new Output for writing to a byte array.
|
UnsafeMemoryOutput(int bufferSize,
int maxBufferSize)
Creates a new Output for writing to a byte array.
|
UnsafeMemoryOutput(long address,
int maxBufferSize) |
UnsafeMemoryOutput(OutputStream outputStream)
Creates a new Output for writing to an OutputStream.
|
UnsafeMemoryOutput(OutputStream outputStream,
int bufferSize)
Creates a new Output for writing to an OutputStream.
|
| Modifier and Type | Method and Description |
|---|---|
void |
setBuffer(ByteBuffer buffer,
int maxBufferSize)
Sets the buffer that will be written to.
|
void |
writeBoolean(boolean value)
Writes a 1 byte boolean.
|
void |
writeByte(byte value) |
void |
writeByte(int value) |
void |
writeBytes(byte[] bytes)
Writes the bytes.
|
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, getByteBuffer, getOutputStream, getVarIntsEnabled, order, order, release, require, setBuffer, setOutputStream, setPosition, setVarIntsEnabled, toBytes, write, write, write, writeAscii, writeBytes, writeDouble, writeFloat, writeLongS, writeString, writeStringpublic UnsafeMemoryOutput()
Output.setBuffer(byte[]) must be called before the Output is used.public UnsafeMemoryOutput(int bufferSize)
bufferSize - The initial and maximum size of the buffer. An exception is thrown if this size is exceeded.public UnsafeMemoryOutput(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 UnsafeMemoryOutput(OutputStream outputStream)
public UnsafeMemoryOutput(OutputStream outputStream, int bufferSize)
public UnsafeMemoryOutput(long address,
int maxBufferSize)
public void setBuffer(ByteBuffer buffer, int maxBufferSize)
ByteBufferOutputOutputStream is set to null.setBuffer in class ByteBufferOutputmaxBufferSize - The buffer is doubled as needed until it exceeds maxCapacity and an exception is thrown.public final void writeInt(int value)
throws KryoException
writeInt in class ByteBufferOutputKryoExceptionpublic final void writeFloat(float value)
throws KryoException
writeFloat in class ByteBufferOutputKryoExceptionpublic final void writeShort(int value)
throws KryoException
writeShort in class ByteBufferOutputKryoExceptionpublic final void writeLong(long value)
throws KryoException
writeLong in class ByteBufferOutputKryoExceptionpublic final void writeByte(int value)
throws KryoException
writeByte in class ByteBufferOutputKryoExceptionpublic void writeByte(byte value)
throws KryoException
writeByte in class ByteBufferOutputKryoExceptionpublic final void writeBoolean(boolean value)
throws KryoException
writeBoolean in class ByteBufferOutputKryoExceptionpublic final void writeChar(char value)
throws KryoException
writeChar in class ByteBufferOutputKryoExceptionpublic final void writeDouble(double value)
throws KryoException
writeDouble in class ByteBufferOutputKryoExceptionpublic final int writeInt(int value,
boolean optimizePositive)
throws KryoException
OutputwriteInt in class ByteBufferOutputoptimizePositive - 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 ByteBufferOutputoptimizePositive - 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 ByteBufferOutputoptimizePositive - 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 ByteBufferOutputoptimizePositive - 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
ByteBufferOutputwriteInts in class ByteBufferOutputKryoExceptionpublic final void writeLongs(long[] object)
throws KryoException
ByteBufferOutputwriteLongs in class ByteBufferOutputKryoExceptionpublic final void writeFloats(float[] object)
throws KryoException
ByteBufferOutputwriteFloats in class ByteBufferOutputKryoExceptionpublic final void writeShorts(short[] object)
throws KryoException
ByteBufferOutputwriteShorts in class ByteBufferOutputKryoExceptionpublic final void writeChars(char[] object)
throws KryoException
ByteBufferOutputwriteChars in class ByteBufferOutputKryoExceptionpublic final void writeDoubles(double[] object)
throws KryoException
ByteBufferOutputwriteDoubles in class ByteBufferOutputKryoExceptionpublic void writeBytes(byte[] bytes)
throws KryoException
writeBytes in class ByteBufferOutputKryoExceptionpublic final void writeBytes(Object obj, long offset, long count) throws KryoException
obj - offset - count - KryoExceptionCopyright © 2023. All rights reserved.