Package libcore.io
Class Memory
java.lang.Object
libcore.io.Memory
public final class Memory extends Object
Unsafe access to memory.
-
Method Summary
Modifier and Type Method Description static voidmemmove(Object dstObject, int dstOffset, Object srcObject, int srcOffset, long byteCount)Copies 'byteCount' bytes from the source to the destination.static bytepeekByte(long address)static voidpeekByteArray(long address, byte[] dst, int dstOffset, int byteCount)static voidpeekCharArray(long address, char[] dst, int dstOffset, int charCount, boolean swap)static voidpeekDoubleArray(long address, double[] dst, int dstOffset, int doubleCount, boolean swap)static voidpeekFloatArray(long address, float[] dst, int dstOffset, int floatCount, boolean swap)static intpeekInt(byte[] src, int offset, ByteOrder order)static intpeekInt(long address, boolean swap)static voidpeekIntArray(long address, int[] dst, int dstOffset, int intCount, boolean swap)static longpeekLong(byte[] src, int offset, ByteOrder order)static longpeekLong(long address, boolean swap)static voidpeekLongArray(long address, long[] dst, int dstOffset, int longCount, boolean swap)static shortpeekShort(byte[] src, int offset, ByteOrder order)static shortpeekShort(long address, boolean swap)static voidpeekShortArray(long address, short[] dst, int dstOffset, int shortCount, boolean swap)static voidpokeByte(long address, byte value)static voidpokeByteArray(long address, byte[] src, int offset, int count)static voidpokeCharArray(long address, char[] src, int offset, int count, boolean swap)static voidpokeDoubleArray(long address, double[] src, int offset, int count, boolean swap)static voidpokeFloatArray(long address, float[] src, int offset, int count, boolean swap)static voidpokeInt(byte[] dst, int offset, int value, ByteOrder order)static voidpokeInt(long address, int value, boolean swap)static voidpokeIntArray(long address, int[] src, int offset, int count, boolean swap)static voidpokeLong(byte[] dst, int offset, long value, ByteOrder order)static voidpokeLong(long address, long value, boolean swap)static voidpokeLongArray(long address, long[] src, int offset, int count, boolean swap)static voidpokeShort(byte[] dst, int offset, short value, ByteOrder order)static voidpokeShort(long address, short value, boolean swap)static voidpokeShortArray(long address, short[] src, int offset, int count, boolean swap)static voidunsafeBulkGet(Object dst, int dstOffset, int byteCount, byte[] src, int srcOffset, int sizeofElements, boolean swap)Used to optimize nio heap buffer bulk get operations.static voidunsafeBulkPut(byte[] dst, int dstOffset, int byteCount, Object src, int srcOffset, int sizeofElements, boolean swap)Used to optimize nio heap buffer bulk put operations.
-
Method Details
-
unsafeBulkGet
public static void unsafeBulkGet(Object dst, int dstOffset, int byteCount, byte[] src, int srcOffset, int sizeofElements, boolean swap)Used to optimize nio heap buffer bulk get operations. 'dst' must be a primitive array. 'dstOffset' is measured in units of 'sizeofElements' bytes. -
unsafeBulkPut
public static void unsafeBulkPut(byte[] dst, int dstOffset, int byteCount, Object src, int srcOffset, int sizeofElements, boolean swap)Used to optimize nio heap buffer bulk put operations. 'src' must be a primitive array. 'srcOffset' is measured in units of 'sizeofElements' bytes. -
peekInt
-
peekLong
-
peekShort
-
pokeInt
-
pokeLong
-
pokeShort
-
memmove
public static void memmove(Object dstObject, int dstOffset, Object srcObject, int srcOffset, long byteCount)Copies 'byteCount' bytes from the source to the destination. The objects are either instances of DirectByteBuffer or byte[]. The offsets in the byte[] case must include the Buffer.arrayOffset if the array came from a Buffer.array call. We could make this private and provide the four type-safe variants, but then ByteBuffer.put(ByteBuffer) would need to work out which to call based on whether the source and destination buffers are direct or not. -
peekByte
public static byte peekByte(long address) -
peekInt
public static int peekInt(long address, boolean swap) -
peekLong
public static long peekLong(long address, boolean swap) -
peekShort
public static short peekShort(long address, boolean swap) -
peekByteArray
public static void peekByteArray(long address, byte[] dst, int dstOffset, int byteCount) -
peekCharArray
public static void peekCharArray(long address, char[] dst, int dstOffset, int charCount, boolean swap) -
peekDoubleArray
public static void peekDoubleArray(long address, double[] dst, int dstOffset, int doubleCount, boolean swap) -
peekFloatArray
public static void peekFloatArray(long address, float[] dst, int dstOffset, int floatCount, boolean swap) -
peekIntArray
public static void peekIntArray(long address, int[] dst, int dstOffset, int intCount, boolean swap) -
peekLongArray
public static void peekLongArray(long address, long[] dst, int dstOffset, int longCount, boolean swap) -
peekShortArray
public static void peekShortArray(long address, short[] dst, int dstOffset, int shortCount, boolean swap) -
pokeByte
public static void pokeByte(long address, byte value) -
pokeInt
public static void pokeInt(long address, int value, boolean swap) -
pokeLong
public static void pokeLong(long address, long value, boolean swap) -
pokeShort
public static void pokeShort(long address, short value, boolean swap) -
pokeByteArray
public static void pokeByteArray(long address, byte[] src, int offset, int count) -
pokeCharArray
public static void pokeCharArray(long address, char[] src, int offset, int count, boolean swap) -
pokeDoubleArray
public static void pokeDoubleArray(long address, double[] src, int offset, int count, boolean swap) -
pokeFloatArray
public static void pokeFloatArray(long address, float[] src, int offset, int count, boolean swap) -
pokeIntArray
public static void pokeIntArray(long address, int[] src, int offset, int count, boolean swap) -
pokeLongArray
public static void pokeLongArray(long address, long[] src, int offset, int count, boolean swap) -
pokeShortArray
public static void pokeShortArray(long address, short[] src, int offset, int count, boolean swap)
-