public class HeapBytesStore<Underlying> extends AbstractBytesStore<HeapBytesStore<Underlying>,Underlying>
charToString
Modifier and Type | Method and Description |
---|---|
long |
addressForRead(long offset)
Obtain the underlying addressForRead.
|
default long |
addressForRead(long offset,
int buffer) |
long |
addressForWrite(long offset)
Obtain the underlying addressForRead.
|
long |
addressForWritePosition() |
default ByteOrder |
byteOrder() |
long |
capacity() |
default boolean |
compareAndSwapDouble(long offset,
double expected,
double value)
Perform a 64-bit double CAS at a given offset.
|
default boolean |
compareAndSwapFloat(long offset,
float expected,
float value)
Perform a 32-bit float CAS at a given offset.
|
boolean |
compareAndSwapInt(long offset,
int expected,
int value)
Perform a 32-bit CAS at a given offset.
|
boolean |
compareAndSwapLong(long offset,
long expected,
long value)
Perform a 64-bit CAS at a given offset.
|
@NotNull BytesStore<HeapBytesStore<Underlying>,Underlying> |
copy() |
boolean |
equals(Object obj) |
boolean |
isDirectMemory() |
void |
move(long from,
long to,
long length) |
void |
nativeRead(long position,
long address,
long size)
expert level method for copying data to native memory.
|
void |
nativeWrite(long address,
long position,
long size)
expert level method to copy data from native memory into the BytesStore
|
protected void |
performRelease() |
byte |
readByte(long offset)
Read byte at an offset
|
double |
readDouble(long offset)
Read a double at an offset
|
float |
readFloat(long offset)
Read a float at an offset
|
int |
readInt(long offset)
Read an int at an offset
|
default long |
readLimit() |
long |
readLong(long offset)
Read a long at an offset
|
short |
readShort(long offset)
Read a short at an offset
|
byte |
readVolatileByte(long offset)
Read a 8-bit byte from memory with a load barrier.
|
int |
readVolatileInt(long offset)
Read a 32-bit int from memory with a load barrier.
|
long |
readVolatileLong(long offset)
Read a 64-bit long from memory with a load barrier.
|
short |
readVolatileShort(long offset)
Read a 16-bit short from memory with a load barrier.
|
boolean |
sharedMemory() |
void |
testAndSetInt(long offset,
int expected,
int value) |
@NotNull String |
toString() |
Underlying |
underlyingObject() |
static @NotNull HeapBytesStore<byte[]> |
wrap(@NotNull byte[] byteArray)
Wraps a byte[].
|
static @NotNull HeapBytesStore<ByteBuffer> |
wrap(@NotNull ByteBuffer bb)
Wraps a ByteBuffer which can be either on heap or off heap.
|
@NotNull HeapBytesStore<Underlying> |
write(long offsetInRDO,
byte[] bytes,
int offset,
int length) |
void |
write(long offsetInRDO,
@NotNull ByteBuffer bytes,
int offset,
int length) |
@NotNull HeapBytesStore<Underlying> |
write(long writeOffset,
@NotNull RandomDataInput bytes,
long readOffset,
long length) |
@NotNull HeapBytesStore<Underlying> |
writeByte(long offset,
byte b)
Write an unsigned byte at an offset.
|
@NotNull HeapBytesStore<Underlying> |
writeDouble(long offset,
double d)
Write a double at an offset.
|
@NotNull HeapBytesStore<Underlying> |
writeFloat(long offset,
float f)
Write a float at an offset.
|
@NotNull HeapBytesStore<Underlying> |
writeInt(long offset,
int i32)
Write an int at an offset.
|
default long |
writeLimit() |
@NotNull HeapBytesStore<Underlying> |
writeLong(long offset,
long i64)
Write a long at an offset.
|
@NotNull HeapBytesStore<Underlying> |
writeOrderedInt(long offset,
int i32)
Perform a non stalling write with a store barrier.
|
@NotNull HeapBytesStore<Underlying> |
writeOrderedLong(long offset,
long i)
Perform a non stalling write with a store barrier.
|
default long |
writePosition()
The read position must be readPosition() <= writePosition() && writePosition() <= writeLimit()
|
default long |
writeRemaining() |
@NotNull HeapBytesStore<Underlying> |
writeShort(long offset,
short i16)
Write a short at an offset.
|
@NotNull HeapBytesStore<Underlying> |
writeVolatileByte(long offset,
byte i8) |
@NotNull HeapBytesStore<Underlying> |
writeVolatileInt(long offset,
int i32) |
@NotNull HeapBytesStore<Underlying> |
writeVolatileLong(long offset,
long i64) |
@NotNull HeapBytesStore<Underlying> |
writeVolatileShort(long offset,
short i16) |
hashCode, peekUnsignedByte, performReleaseInBackground, readPosition, readRemaining, start
assertReferencesReleased, createdHere, disableReferenceTracing, enableReferenceTracing, refCount, referenceId, release, releaseLast, reserve, reservedBy, reserveTransfer, threadSafetyCheck, throwExceptionIfNotReleased, throwExceptionIfReleased, tryReserve, unmonitor, warnAndReleaseIfNotReleased
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAndGetByteNotAtomic, addAndGetDoubleNotAtomic, addAndGetFloatNotAtomic, addAndGetIntNotAtomic, addAndGetLongNotAtomic, addAndGetShortNotAtomic, addAndGetUnsignedByteNotAtomic, addAndGetUnsignedIntNotAtomic, addAndGetUnsignedShortNotAtomic, byteCheckSum, byteCheckSum, bytesForRead, bytesForWrite, bytesStore, charAt, cipher, cipher, contentEquals, copyTo, copyTo, empty, endsWith, equalBytes, from, inside, inside, isClear, isEmpty, isPresent, isPresent, length, longCheckSum, nativePointer, readWrite, realCapacity, safeLimit, startsWith, startsWith, subSequence, to8bitString, toDebugString, toDebugString, wrap, writeMaxLong, zeroOut
addAndGetDouble, addAndGetFloat, addAndGetInt, addAndGetLong, canReadDirect, compareUtf8, copyTo, copyTo, createCharToString, fastHash, findByte, parseLong, peekVolatileInt, printable, read, readBoolean, readIncompleteLong, readUnsignedByte, readUnsignedInt, readUnsignedInt24, readUnsignedShort, readUtf8, readUtf8Limited, readUtf8Limited, readVolatileDouble, readVolatileFloat, subBytes, toByteArray, toTemporaryDirectByteBuffer
append, append, write, write, writeBoolean, writeByte, writeInt24, writeOrderedDouble, writeOrderedFloat, writeUnsignedByte, writeUnsignedInt, writeUnsignedShort, writeUtf8, writeUtf8Limited, writeVolatileDouble, writeVolatileFloat
refCount, release, releaseLast, releaseLast, reserve, reservedBy, reserveTransfer, tryReserve
referenceId, referenceName, temporary
chars, codePoints
@NotNull public static @NotNull HeapBytesStore<byte[]> wrap(@NotNull @NotNull byte[] byteArray)
BytesStore
byteArray
- to wrap@NotNull public static @NotNull HeapBytesStore<ByteBuffer> wrap(@NotNull @NotNull ByteBuffer bb)
BytesStore
bb
- to wrappublic boolean isDirectMemory()
public void move(long from, long to, long length)
@NotNull public @NotNull String toString()
toString
in interface CharSequence
toString
in class net.openhft.chronicle.core.io.AbstractReferenceCounted
@NotNull public @NotNull BytesStore<HeapBytesStore<Underlying>,Underlying> copy()
protected void performRelease()
performRelease
in class net.openhft.chronicle.core.io.AbstractReferenceCounted
public long capacity()
@NotNull public Underlying underlyingObject()
public boolean compareAndSwapInt(long offset, int expected, int value)
offset
- to perform CASexpected
- valuevalue
- to setpublic void testAndSetInt(long offset, int expected, int value)
public boolean compareAndSwapLong(long offset, long expected, long value)
offset
- to perform CASexpected
- valuevalue
- to setpublic byte readByte(long offset) throws BufferUnderflowException
RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the Bytespublic short readShort(long offset) throws BufferUnderflowException
RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the Bytespublic int readInt(long offset) throws BufferUnderflowException
RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the Bytespublic long readLong(long offset) throws BufferUnderflowException
RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the Bytespublic float readFloat(long offset) throws BufferUnderflowException
RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the Bytespublic double readDouble(long offset) throws BufferUnderflowException
RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the Bytespublic byte readVolatileByte(long offset) throws BufferUnderflowException
RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the Bytespublic short readVolatileShort(long offset) throws BufferUnderflowException
RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the Bytespublic int readVolatileInt(long offset) throws BufferUnderflowException
RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the Bytespublic long readVolatileLong(long offset) throws BufferUnderflowException
RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the Bytes@NotNull public @NotNull HeapBytesStore<Underlying> writeByte(long offset, byte b) throws BufferOverflowException
RandomDataOutput
offset
- to write tob
- the valueBufferOverflowException
- if the capacity was exceeded@NotNull public @NotNull HeapBytesStore<Underlying> writeShort(long offset, short i16) throws BufferOverflowException
RandomDataOutput
offset
- to write toi16
- the valueBufferOverflowException
- if the capacity was exceeded@NotNull public @NotNull HeapBytesStore<Underlying> writeInt(long offset, int i32) throws BufferOverflowException
RandomDataOutput
offset
- to write toi32
- the valueBufferOverflowException
- if the capacity was exceeded@NotNull public @NotNull HeapBytesStore<Underlying> writeOrderedInt(long offset, int i32) throws BufferOverflowException
RandomDataOutput
offset
- to write toi32
- value to writeBufferOverflowException
- if the capacity was exceeded@NotNull public @NotNull HeapBytesStore<Underlying> writeLong(long offset, long i64) throws BufferOverflowException
RandomDataOutput
offset
- to write toi64
- the valueBufferOverflowException
- if the capacity was exceeded@NotNull public @NotNull HeapBytesStore<Underlying> writeOrderedLong(long offset, long i) throws BufferOverflowException
RandomDataOutput
offset
- to write toi
- value to writeBufferOverflowException
@NotNull public @NotNull HeapBytesStore<Underlying> writeFloat(long offset, float f) throws BufferOverflowException
RandomDataOutput
offset
- to write tof
- the valueBufferOverflowException
- if the capacity was exceeded@NotNull public @NotNull HeapBytesStore<Underlying> writeDouble(long offset, double d) throws BufferOverflowException
RandomDataOutput
offset
- to write tod
- the valueBufferOverflowException
- if the capacity was exceeded@NotNull public @NotNull HeapBytesStore<Underlying> writeVolatileByte(long offset, byte i8) throws BufferOverflowException
BufferOverflowException
@NotNull public @NotNull HeapBytesStore<Underlying> writeVolatileShort(long offset, short i16) throws BufferOverflowException
BufferOverflowException
@NotNull public @NotNull HeapBytesStore<Underlying> writeVolatileInt(long offset, int i32) throws BufferOverflowException
BufferOverflowException
@NotNull public @NotNull HeapBytesStore<Underlying> writeVolatileLong(long offset, long i64) throws BufferOverflowException
BufferOverflowException
@NotNull public @NotNull HeapBytesStore<Underlying> write(long offsetInRDO, byte[] bytes, int offset, int length) throws BufferOverflowException
BufferOverflowException
public void write(long offsetInRDO, @NotNull @NotNull ByteBuffer bytes, int offset, int length) throws BufferOverflowException
BufferOverflowException
@NotNull public @NotNull HeapBytesStore<Underlying> write(long writeOffset, @NotNull @NotNull RandomDataInput bytes, long readOffset, long length)
public long addressForRead(long offset) throws UnsupportedOperationException
offset
- within this buffer. addressForRead(start()) is the actual addressForRead of the first byte.UnsupportedOperationException
- if the underlying buffer is on the heappublic long addressForWrite(long offset) throws UnsupportedOperationException
offset
- within this buffer. addressForRead(start()) is the actual addressForRead of the first byte.UnsupportedOperationException
- if the underlying buffer is on the heappublic long addressForWritePosition() throws UnsupportedOperationException, BufferOverflowException
public void nativeRead(long position, long address, long size)
RandomDataInput
position
- within the ByteStore to copy.address
- in native memorysize
- in bytespublic void nativeWrite(long address, long position, long size)
RandomDataOutput
address
- in native memory to copy fromposition
- in BytesStore to copy tosize
- in bytespublic boolean sharedMemory()
public long writePosition()
public long writeRemaining()
public long readLimit()
public long writeLimit()
public long addressForRead(long offset, int buffer) throws UnsupportedOperationException, BufferUnderflowException
public ByteOrder byteOrder()
public boolean compareAndSwapFloat(long offset, float expected, float value) throws BufferOverflowException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
public boolean compareAndSwapDouble(long offset, double expected, double value) throws BufferOverflowException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
Copyright © 2020. All rights reserved.