Class ByteBufferIO
- java.lang.Object
-
- com._1c.g5.v8.bm.common.serialization.ByteBufferIO
-
public class ByteBufferIO extends Object
Byte buffer I/O utilities. This code originally comes from Kryo Framework, author Nathan Sweet. Modified source to fit our needs.
-
-
Constructor Summary
Constructors Constructor Description ByteBufferIO()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static int
calcInt(int value)
Calculates how many bytes packed value will occupy.static int
packInt(byte[] out, int value, int stPos)
Packs non-negative int into output array.static void
packInt(ByteBufferStream out, int value)
Deprecated.static void
packInt(ByteBuffer out, int value)
Packs non-negative int into output buffer.static void
packLong(ByteBuffer out, long value)
Packs non-negative long into output buffer.static int
unpackInt(ByteBuffer is)
Unpack positive int value from the input buffer.static long
unpackLong(ByteBuffer in)
Unpack positive long value from the input buffer.
-
-
-
Method Detail
-
packLong
public static void packLong(ByteBuffer out, long value)
Packs non-negative long into output buffer. It will occupy 1-10 bytes depending on value (lower values occupy smaller space)This method originally comes from Kryo Framework, author Nathan Sweet.
- Parameters:
out
- the buffer to put value into, may not benull
.value
- the value to be serialized, must be non-negative
-
packInt
public static void packInt(ByteBuffer out, int value)
Packs non-negative int into output buffer. It will occupy 1-5 bytes depending on value (lower values occupy smaller space)This method originally comes from Kryo Framework, author Nathan Sweet.
- Parameters:
out
- the buffer to put value into, may not benull
.value
- the value to be serialized, must be non-negative
-
packInt
public static int packInt(byte[] out, int value, int stPos)
Packs non-negative int into output array. It will occupy 1-5 bytes depending on value (lower values occupy smaller space)This method originally comes from Kryo Framework, author Nathan Sweet.
- Parameters:
out
- the array to put value into, may not benull
.value
- the value to be serialized, must be non-negativestPos
- the position in the output array to start writing at.
-
packInt
@Deprecated public static void packInt(ByteBufferStream out, int value)
Deprecated.Packs non-negative long into output buffer stream. It will occupy 1-10 bytes depending on value (lower values occupy smaller space)This method originally comes from Kryo Framework, author Nathan Sweet.
- Parameters:
out
- the buffer to put value into, may not benull
.value
- the value to be serialized, must be non-negative
-
calcInt
public static int calcInt(int value)
Calculates how many bytes packed value will occupy.- Parameters:
value
- The value.- Returns:
- the number of bytes the packed value will occupy.
-
unpackInt
public static int unpackInt(ByteBuffer is)
Unpack positive int value from the input buffer.This method originally comes from Kryo Framework, author Nathan Sweet.
- Parameters:
is
- The input buffer, may not benull
.- Returns:
- The unpacked int value.
-
unpackLong
public static long unpackLong(ByteBuffer in)
Unpack positive long value from the input buffer.This method originally comes from Kryo Framework, author Nathan Sweet.
- Parameters:
in
- The input buffer, may not benull
.- Returns:
- The unpacked long value.
-
-