Package com._1c.g5.v8.xmdb.unsafe
Class UnsafeMemoryOld
java.lang.Object
com._1c.g5.v8.xmdb.unsafe.UnsafeMemoryOld
Wrapper around sun.misc.Unsafe to speedup some memory manipulation
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintGet total base array sizebooleanRead boolean from current positionbytegetByte()Read byte from current positionbyte[]Read byte[] from current position.byte[]getByteArray(int arraySize) Read byte[] from current position.double[]Read double[] from current position.intgetInt()Read integer from current positionint[]Read int array from current position.int[]getIntArray(int arraySize) Read int array from current position.longgetLong()Read long from current positionlong[]Read long[] from current postion.long[]getLongArray(int arraySize) Read long array from current position.intgetPos()Get current position on base arrayvoidputBoolean(boolean value) Write boolean to current positionvoidputByte(byte value) Write byte to current positionvoidputByteArray(byte[] values) Write byte[] to current position.voidputByteArrayRaw(byte[] values) Write byte[] to current position without array length data;voidputDoubleArray(double[] values) Write double[] to current array.voidputInt(int value) Write integer to current positionvoidputIntArray(int[] values) Write int[] to current position.voidputIntArrayRaw(int[] values) Write int array to current position without array length data.voidputLong(long value) Write long to current positionvoidputLongArray(long[] values) Write long array to current position.voidputLongArrayRaw(long[] values) Write long[] to current position without array length data.voidreset()Set position to 0
-
Constructor Details
-
UnsafeMemoryOld
public UnsafeMemoryOld(byte[] buffer) Wrap byte array- Parameters:
buffer-
-
-
Method Details
-
reset
public void reset()Set position to 0 -
putBoolean
public void putBoolean(boolean value) Write boolean to current position- Parameters:
value- boolean to write
-
getBoolean
public boolean getBoolean()Read boolean from current position- Returns:
- boolean from base array
-
putInt
public void putInt(int value) Write integer to current position- Parameters:
value- integer to write
-
getInt
public int getInt()Read integer from current position- Returns:
- integer from base array
-
putLong
public void putLong(long value) Write long to current position- Parameters:
value- long to write
-
getLong
public long getLong()Read long from current position- Returns:
- long from base array
-
putLongArray
public void putLongArray(long[] values) Write long array to current position. Write array length too;- Parameters:
values- long array to write
-
putByte
public void putByte(byte value) Write byte to current position- Parameters:
value- byte to write
-
getByte
public byte getByte()Read byte from current position- Returns:
- byte from base array
-
putLongArrayRaw
public void putLongArrayRaw(long[] values) Write long[] to current position without array length data.- Parameters:
values- long[] to write
-
getLongArray
public long[] getLongArray()Read long[] from current postion. Array length should be there (by putLongArray method).- Returns:
- long[] from base array
-
getLongArray
public long[] getLongArray(int arraySize) Read long array from current position. Array length from parameter- Parameters:
arraySize- count of long to read- Returns:
- long[] from base array
-
getIntArray
public int[] getIntArray()Read int array from current position. Array length should be there (by putIntArray method).- Returns:
- int[] from base array
-
getIntArray
public int[] getIntArray(int arraySize) Read int array from current position. Array length from parameter- Parameters:
arraySize- count of int to read- Returns:
- int[] from base array
-
putIntArray
public void putIntArray(int[] values) Write int[] to current position. Write int array length too.- Parameters:
values- int[] to write
-
putIntArrayRaw
public void putIntArrayRaw(int[] values) Write int array to current position without array length data.- Parameters:
values- int[] to write
-
getByteArray
public byte[] getByteArray()Read byte[] from current position. Array length should be there (by putByteArray method)- Returns:
- byte[] from base array
-
getByteArray
public byte[] getByteArray(int arraySize) Read byte[] from current position. Array length from parameter.- Parameters:
arraySize- count of int to read- Returns:
- int[] from base array
-
putByteArray
public void putByteArray(byte[] values) Write byte[] to current position. Write valuer array length data.- Parameters:
values- byte[] to write
-
putByteArrayRaw
public void putByteArrayRaw(byte[] values) Write byte[] to current position without array length data;- Parameters:
values- byte[] to write
-
putDoubleArray
public void putDoubleArray(double[] values) Write double[] to current array. Write values array length data- Parameters:
values- double[] to write
-
getDoubleArray
public double[] getDoubleArray()Read double[] from current position. Array length should be there (by putDoubleArray method)- Returns:
- double[] form base array
-
getPos
public int getPos()Get current position on base array- Returns:
- current position
-
getAllocated
public int getAllocated()Get total base array size- Returns:
- base array (allocated) size
-