defaultMemReqSvr| Modifier and Type | Method and Description |
|---|---|
static WritableMemory |
allocate(int capacityBytes)
Creates on-heap WritableMemory with the given capacity and the native byte order.
|
static WritableMemory |
allocate(int capacityBytes,
ByteOrder byteOrder)
Creates on-heap WritableMemory with the given capacity and the given byte order.
|
static WritableMemory |
allocate(int capacityBytes,
ByteOrder byteOrder,
MemoryRequestServer memReqSvr)
Creates on-heap WritableMemory with the given capacity and the given byte order.
|
static WritableHandle |
allocateDirect(long capacityBytes)
Allocates and provides access to capacityBytes directly in native (off-heap) memory.
|
static WritableHandle |
allocateDirect(long capacityBytes,
ByteOrder byteOrder,
MemoryRequestServer memReqSvr)
Allocates and provides access to capacityBytes directly in native (off-heap) memory.
|
default WritableBuffer |
asWritableBuffer()
Returns a new WritableBuffer with a writable view of this object.
|
WritableBuffer |
asWritableBuffer(ByteOrder byteOrder)
Returns a new WritableBuffer with a writable view of this object
with the given byte order.
|
void |
clear()
Clears all bytes of this Memory to zero
|
void |
clear(long offsetBytes,
long lengthBytes)
Clears a portion of this Memory to zero.
|
void |
clearBits(long offsetBytes,
byte bitMask)
Clears the bits defined by the bitMask
|
boolean |
compareAndSwapLong(long offsetBytes,
long expect,
long update)
Atomically sets the current value at the memory location to the given updated value
if and only if the current value
== the expected value. |
void |
fill(byte value)
Fills all bytes of this Memory region to the given byte value.
|
void |
fill(long offsetBytes,
long lengthBytes,
byte value)
Fills a portion of this Memory region to the given byte value.
|
long |
getAndAddLong(long offsetBytes,
long delta)
Atomically adds the given value to the long located at offsetBytes.
|
long |
getAndSetLong(long offsetBytes,
long newValue)
Atomically exchanges the given value with the current value located at offsetBytes.
|
Object |
getArray()
Returns the primitive backing array, otherwise null.
|
MemoryRequestServer |
getMemoryRequestServer()
WritableMemory enables this for ByteBuffer, Heap and Direct Memory backed resources.
|
void |
putBoolean(long offsetBytes,
boolean value)
Puts the boolean value at the given offset
|
void |
putBooleanArray(long offsetBytes,
boolean[] srcArray,
int srcOffsetBooleans,
int lengthBooleans)
Puts the boolean array at the given offset
|
void |
putByte(long offsetBytes,
byte value)
Puts the byte value at the given offset
|
void |
putByteArray(long offsetBytes,
byte[] srcArray,
int srcOffsetBytes,
int lengthBytes)
Puts the byte array at the given offset
|
void |
putChar(long offsetBytes,
char value)
Puts the char value at the given offset
|
void |
putCharArray(long offsetBytes,
char[] srcArray,
int srcOffsetChars,
int lengthChars)
Puts the char array at the given offset
|
long |
putCharsToUtf8(long offsetBytes,
CharSequence src)
Encodes characters from the given CharSequence into UTF-8 bytes and puts them into this
WritableMemory begining at the given offsetBytes.
|
void |
putDouble(long offsetBytes,
double value)
Puts the double value at the given offset
|
void |
putDoubleArray(long offsetBytes,
double[] srcArray,
int srcOffsetDoubles,
int lengthDoubles)
Puts the double array at the given offset
|
void |
putFloat(long offsetBytes,
float value)
Puts the float value at the given offset
|
void |
putFloatArray(long offsetBytes,
float[] srcArray,
int srcOffsetFloats,
int lengthFloats)
Puts the float array at the given offset
|
void |
putInt(long offsetBytes,
int value)
Puts the int value at the given offset
|
void |
putIntArray(long offsetBytes,
int[] srcArray,
int srcOffsetInts,
int lengthInts)
Puts the int array at the given offset
|
void |
putLong(long offsetBytes,
long value)
Puts the long value at the given offset
|
void |
putLongArray(long offsetBytes,
long[] srcArray,
int srcOffsetLongs,
int lengthLongs)
Puts the long array at the given offset
|
void |
putShort(long offsetBytes,
short value)
Puts the short value at the given offset
|
void |
putShortArray(long offsetBytes,
short[] srcArray,
int srcOffsetShorts,
int lengthShorts)
Puts the short array at the given offset
|
void |
setBits(long offsetBytes,
byte bitMask)
Sets the bits defined by the bitMask
|
static WritableMapHandle |
writableMap(File file)
Maps the entire given file into native-ordered WritableMemory for write operations
Calling this method is equivalent to calling
writableMap(file, 0, file.length(), ByteOrder.nativeOrder()). |
static WritableMapHandle |
writableMap(File file,
long fileOffsetBytes,
long capacityBytes,
ByteOrder byteOrder)
Maps the specified portion of the given file into Memory for write operations.
|
default WritableMemory |
writableRegion(long offsetBytes,
long capacityBytes)
A writable region is a writable view of this object.
|
WritableMemory |
writableRegion(long offsetBytes,
long capacityBytes,
ByteOrder byteOrder)
A writable region is a writable view of this object.
|
static WritableMemory |
writableWrap(boolean[] array)
Wraps the given primitive array for write operations assuming native byte order.
|
static WritableMemory |
writableWrap(byte[] array)
Wraps the given primitive array for write operations assuming native byte order.
|
static WritableMemory |
writableWrap(byte[] array,
ByteOrder byteOrder)
Wraps the given primitive array for write operations with the given byte order.
|
static WritableMemory |
writableWrap(byte[] array,
int offsetBytes,
int lengthBytes,
ByteOrder byteOrder)
Wraps the given primitive array for write operations with the given byte order.
|
static WritableMemory |
writableWrap(byte[] array,
int offsetBytes,
int lengthBytes,
ByteOrder byteOrder,
MemoryRequestServer memReqSvr)
Wraps the given primitive array for write operations with the given byte order.
|
static WritableMemory |
writableWrap(ByteBuffer byteBuffer)
Accesses the given ByteBuffer for write operations.
|
static WritableMemory |
writableWrap(ByteBuffer byteBuffer,
ByteOrder byteOrder)
Accesses the given ByteBuffer for write operations.
|
static WritableMemory |
writableWrap(ByteBuffer byteBuffer,
ByteOrder byteOrder,
MemoryRequestServer memReqSvr)
Accesses the given ByteBuffer for write operations.
|
static WritableMemory |
writableWrap(char[] array)
Wraps the given primitive array for write operations assuming native byte order.
|
static WritableMemory |
writableWrap(double[] array)
Wraps the given primitive array for write operations assuming native byte order.
|
static WritableMemory |
writableWrap(float[] array)
Wraps the given primitive array for write operations assuming native byte order.
|
static WritableMemory |
writableWrap(int[] array)
Wraps the given primitive array for write operations assuming native byte order.
|
static WritableMemory |
writableWrap(long[] array)
Wraps the given primitive array for write operations assuming native byte order.
|
static WritableMemory |
writableWrap(short[] array)
Wraps the given primitive array for write operations assuming native byte order.
|
asBuffer, asBuffer, compareTo, copyTo, getBoolean, getBooleanArray, getByte, getByteArray, getChar, getCharArray, getCharsFromUtf8, getCharsFromUtf8, getDouble, getDoubleArray, getFloat, getFloatArray, getInt, getIntArray, getLong, getLongArray, getShort, getShortArray, map, map, region, region, wrap, wrap, wrap, wrap, wrap, wrap, wrap, wrap, wrap, wrap, wrap, wrap, writeTocheckValidAndBounds, equals, equalTo, getByteBuffer, getCapacity, getCumulativeOffset, getCumulativeOffset, getCurrentDirectMemoryAllocated, getCurrentDirectMemoryAllocations, getCurrentDirectMemoryMapAllocated, getCurrentDirectMemoryMapAllocations, getRegionOffset, getRegionOffset, getTypeByteOrder, hasArray, hasByteBuffer, hashCode, isByteOrderCompatible, isDirect, isReadOnly, isSameResource, isValid, toHexString, xxHash64, xxHash64static WritableMemory writableWrap(ByteBuffer byteBuffer)
byteBuffer - the given ByteBuffer. It must be non-null, with capacity ≥ 0, and writable.static WritableMemory writableWrap(ByteBuffer byteBuffer, ByteOrder byteOrder)
byteBuffer - the given ByteBuffer. It must be non-null, with capacity ≥ 0, and writable.byteOrder - the byte order to be used. It must be non-null.static WritableMemory writableWrap(ByteBuffer byteBuffer, ByteOrder byteOrder, MemoryRequestServer memReqSvr)
byteBuffer - the given ByteBuffer. It must be non-null, with capacity ≥ 0, and writable.byteOrder - the byte order to be used. It must be non-null.memReqSvr - A user-specified MemoryRequestServer, which may be null.
This is a callback mechanism for a user client to request a larger WritableMemory.static WritableMapHandle writableMap(File file)
writableMap(file, 0, file.length(), ByteOrder.nativeOrder()).file - the given file to map. It must be non-null, with length ≥ 0, and writable.Handle.static WritableMapHandle writableMap(File file, long fileOffsetBytes, long capacityBytes, ByteOrder byteOrder)
Note: Always qualify this method with the class name, e.g., WritableMemory.map(...).
file - the given file to map. It must be non-null, writable and length ≥ 0.fileOffsetBytes - the position in the given file in bytes. It must not be negative.capacityBytes - the size of the mapped Memory. It must not be negative.byteOrder - the byte order to be used for the given file. It must be non-null.Handle.static WritableHandle allocateDirect(long capacityBytes)
NOTE: Native/Direct memory acquired may have garbage in it. It is the responsibility of the using application to clear this memory, if required, and to call close() when done.
capacityBytes - the size of the desired memory in bytes. It must be ≥ 0.Handle.static WritableHandle allocateDirect(long capacityBytes, ByteOrder byteOrder, MemoryRequestServer memReqSvr)
NOTE: Native/Direct memory acquired may have garbage in it. It is the responsibility of the using application to clear this memory, if required, and to call close() when done.
capacityBytes - the size of the desired memory in bytes. It must be ≥ 0.byteOrder - the given byte order. It must be non-null.memReqSvr - A user-specified MemoryRequestServer, which may be null.
This is a callback mechanism for a user client of direct memory to request more memory.Handle.default WritableMemory writableRegion(long offsetBytes, long capacityBytes)
offsetBytes - the starting offset with respect to this object. It must be ≥ 0.capacityBytes - the capacity of the returned object in bytes. It must be ≥ 0.WritableMemory writableRegion(long offsetBytes, long capacityBytes, ByteOrder byteOrder)
offsetBytes - the starting offset with respect to this object. It must be ≥ 0.capacityBytes - the capacity of the returned object in bytes. It must be ≥ 0.byteOrder - the given byte order. It must be non-null.default WritableBuffer asWritableBuffer()
WritableBuffer asWritableBuffer(ByteOrder byteOrder)
byteOrder - the given byte orderstatic WritableMemory allocate(int capacityBytes)
capacityBytes - the given capacity in bytes. It must be ≥ 0.static WritableMemory allocate(int capacityBytes, ByteOrder byteOrder)
capacityBytes - the given capacity in bytes. It must be ≥ 0.byteOrder - the given byte order to allocate new Memory object with. It must be non-null.static WritableMemory allocate(int capacityBytes, ByteOrder byteOrder, MemoryRequestServer memReqSvr)
capacityBytes - the given capacity in bytes. It must be ≥ 0.byteOrder - the given byte order to allocate new Memory object with. It must be non-null.memReqSvr - A user-specified MemoryRequestServer, which may be null.
This is a callback mechanism for a user client to request a larger WritableMemory.static WritableMemory writableWrap(byte[] array)
Note: Always qualify this method with the class name, e.g., WritableMemory.wrap(...).
array - the given primitive array. It must be non-null.static WritableMemory writableWrap(byte[] array, ByteOrder byteOrder)
Note: Always qualify this method with the class name, e.g., WritableMemory.wrap(...).
array - the given primitive array. It must be non-null.byteOrder - the byte order to be used. It must be non-null.static WritableMemory writableWrap(byte[] array, int offsetBytes, int lengthBytes, ByteOrder byteOrder)
Note: Always qualify this method with the class name, e.g., WritableMemory.wrap(...).
array - the given primitive array. It must be non-null.offsetBytes - the byte offset into the given array. It must be ≥ 0.lengthBytes - the number of bytes to include from the given array. It must be ≥ 0.byteOrder - the byte order to be used. It must be non-null.static WritableMemory writableWrap(byte[] array, int offsetBytes, int lengthBytes, ByteOrder byteOrder, MemoryRequestServer memReqSvr)
Note: Always qualify this method with the class name, e.g., WritableMemory.wrap(...).
array - the given primitive array. It must be non-null.offsetBytes - the byte offset into the given array. It must be ≥ 0.lengthBytes - the number of bytes to include from the given array. It must be ≥ 0.byteOrder - the byte order to be used. It must be non-null.memReqSvr - A user-specified MemoryRequestServer, which may be null.
This is a callback mechanism for a user client to request a larger WritableMemory.static WritableMemory writableWrap(boolean[] array)
array - the given primitive array. It must be non-null.static WritableMemory writableWrap(char[] array)
array - the given primitive array.static WritableMemory writableWrap(short[] array)
array - the given primitive array.static WritableMemory writableWrap(int[] array)
array - the given primitive array.static WritableMemory writableWrap(long[] array)
array - the given primitive array.static WritableMemory writableWrap(float[] array)
array - the given primitive array.static WritableMemory writableWrap(double[] array)
array - the given primitive array.void putBoolean(long offsetBytes,
boolean value)
offsetBytes - offset bytes relative to this WritableMemory startvalue - the value to putvoid putBooleanArray(long offsetBytes,
boolean[] srcArray,
int srcOffsetBooleans,
int lengthBooleans)
offsetBytes - offset bytes relative to this WritableMemory startsrcArray - The source array.srcOffsetBooleans - offset in array unitslengthBooleans - number of array units to transfervoid putByte(long offsetBytes,
byte value)
offsetBytes - offset bytes relative to this WritableMemory startvalue - the value to putvoid putByteArray(long offsetBytes,
byte[] srcArray,
int srcOffsetBytes,
int lengthBytes)
offsetBytes - offset bytes relative to this WritableMemory startsrcArray - The source array.srcOffsetBytes - offset in array unitslengthBytes - number of array units to transfervoid putChar(long offsetBytes,
char value)
offsetBytes - offset bytes relative to this WritableMemory startvalue - the value to putvoid putCharArray(long offsetBytes,
char[] srcArray,
int srcOffsetChars,
int lengthChars)
offsetBytes - offset bytes relative to this WritableMemory startsrcArray - The source array.srcOffsetChars - offset in array unitslengthChars - number of array units to transferlong putCharsToUtf8(long offsetBytes,
CharSequence src)
offsetBytes - offset bytes relative to this WritableMemory startsrc - The source CharSequence to be encoded and put into this WritableMemory. It is
the responsibility of the caller to provide sufficient capacity in this
WritableMemory for the encoded Utf8 bytes. Characters outside the ASCII range can
require 2, 3 or 4 bytes per character to encode.void putDouble(long offsetBytes,
double value)
offsetBytes - offset bytes relative to this WritableMemory startvalue - the value to putvoid putDoubleArray(long offsetBytes,
double[] srcArray,
int srcOffsetDoubles,
int lengthDoubles)
offsetBytes - offset bytes relative to this WritableMemory startsrcArray - The source array.srcOffsetDoubles - offset in array unitslengthDoubles - number of array units to transfervoid putFloat(long offsetBytes,
float value)
offsetBytes - offset bytes relative to this WritableMemory startvalue - the value to putvoid putFloatArray(long offsetBytes,
float[] srcArray,
int srcOffsetFloats,
int lengthFloats)
offsetBytes - offset bytes relative to this WritableMemory startsrcArray - The source array.srcOffsetFloats - offset in array unitslengthFloats - number of array units to transfervoid putInt(long offsetBytes,
int value)
offsetBytes - offset bytes relative to this WritableMemory startvalue - the value to putvoid putIntArray(long offsetBytes,
int[] srcArray,
int srcOffsetInts,
int lengthInts)
offsetBytes - offset bytes relative to this WritableMemory startsrcArray - The source array.srcOffsetInts - offset in array unitslengthInts - number of array units to transfervoid putLong(long offsetBytes,
long value)
offsetBytes - offset bytes relative to this WritableMemory startvalue - the value to putvoid putLongArray(long offsetBytes,
long[] srcArray,
int srcOffsetLongs,
int lengthLongs)
offsetBytes - offset bytes relative to this WritableMemory startsrcArray - The source array.srcOffsetLongs - offset in array unitslengthLongs - number of array units to transfervoid putShort(long offsetBytes,
short value)
offsetBytes - offset bytes relative to this WritableMemory startvalue - the value to putvoid putShortArray(long offsetBytes,
short[] srcArray,
int srcOffsetShorts,
int lengthShorts)
offsetBytes - offset bytes relative to this WritableMemory startsrcArray - The source array.srcOffsetShorts - offset in array unitslengthShorts - number of array units to transferlong getAndAddLong(long offsetBytes,
long delta)
offsetBytes - offset bytes relative to this Memory startdelta - the amount to addboolean compareAndSwapLong(long offsetBytes,
long expect,
long update)
== the expected value.offsetBytes - offset bytes relative to this Memory startexpect - the expected valueupdate - the new valuetrue if successful. False return indicates that
the current value at the memory location was not equal to the expected value.long getAndSetLong(long offsetBytes,
long newValue)
offsetBytes - offset bytes relative to this Memory startnewValue - new valueObject getArray()
void clear()
void clear(long offsetBytes,
long lengthBytes)
offsetBytes - offset bytes relative to this Memory startlengthBytes - the length in bytesvoid clearBits(long offsetBytes,
byte bitMask)
offsetBytes - offset bytes relative to this Memory start.bitMask - the bits set to one will be clearedvoid fill(byte value)
value - the given byte valuevoid fill(long offsetBytes,
long lengthBytes,
byte value)
offsetBytes - offset bytes relative to this Memory startlengthBytes - the length in bytesvalue - the given byte valuevoid setBits(long offsetBytes,
byte bitMask)
offsetBytes - offset bytes relative to this Memory startbitMask - the bits set to one will be setMemoryRequestServer getMemoryRequestServer()
Copyright © 2015–2020 The Apache Software Foundation. All rights reserved.