U
- Underlying typepublic class HeapBytesStore<U> extends AbstractBytesStore<HeapBytesStore<U>,U>
referenceCounted, WARN_COUNT, WARN_NS
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() |
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<U>,U> |
copy() |
boolean |
equals(Object obj) |
static <T> HeapBytesStore<T> |
forFields(Object o,
String groupName,
int padding) |
int |
hashCode() |
boolean |
isDirectMemory() |
default long |
lengthWritten(long startPosition)
Typically this calculates the difference however for HexDumpBytes it's not as simple.
|
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()
If the resource is closed, the returned value is unspecified.
|
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.
|
default long |
realReadRemaining()
If the resource is closed, the returned value is unspecified.
|
default long |
realWriteRemaining()
If the resource is closed, the returned value is unspecified.
|
boolean |
sharedMemory() |
void |
testAndSetInt(long offset,
int expected,
int value) |
@NotNull String |
toString() |
U |
underlyingObject() |
static @NotNull HeapBytesStore<byte[]> |
wrap(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<U> |
write(long offsetInRDO,
byte[] byteArray,
int offset,
int length)
Copies the provided
byteArray to this Bytes object starting at writeOffset taking
content starting at readOffset but copying at most length bytes. |
void |
write(long offsetInRDO,
@NotNull ByteBuffer bytes,
int offset,
int length)
Copy from ByteBuffer into this.
|
@NotNull HeapBytesStore<U> |
write(long writeOffset,
@NotNull RandomDataInput bytes,
long readOffset,
long length)
Copy from RandomDataInput into this.
|
long |
write8bit(long position,
@NotNull BytesStore bs)
Write the stop bit length and copy the BytesStore
|
long |
write8bit(long position,
@NotNull String s,
int start,
int length) |
@NotNull HeapBytesStore<U> |
writeByte(long offset,
byte b)
Write an unsigned byte at an offset.
|
@NotNull HeapBytesStore<U> |
writeDouble(long offset,
double d)
Write a double at an offset.
|
@NotNull HeapBytesStore<U> |
writeFloat(long offset,
float f)
Write a float at an offset.
|
@NotNull HeapBytesStore<U> |
writeInt(long offset,
int i32)
Write an int at an offset.
|
default long |
writeLimit()
Returns the write limit.
|
@NotNull HeapBytesStore<U> |
writeLong(long offset,
long i64)
Write a long at an offset.
|
@NotNull HeapBytesStore<U> |
writeOrderedInt(long offset,
int i32)
Perform a non stalling write with a store barrier.
|
@NotNull HeapBytesStore<U> |
writeOrderedLong(long offset,
long i)
Perform a non stalling write with a store barrier.
|
default long |
writePosition()
Returns the write position.
|
@NotNull HeapBytesStore<U> |
writeShort(long offset,
short i16)
Write a short at an offset.
|
@NotNull HeapBytesStore<U> |
writeVolatileByte(long offset,
byte i8) |
@NotNull HeapBytesStore<U> |
writeVolatileInt(long offset,
int i32) |
@NotNull HeapBytesStore<U> |
writeVolatileLong(long offset,
long i64) |
@NotNull HeapBytesStore<U> |
writeVolatileShort(long offset,
short i16) |
canReleaseInBackground, peekUnsignedByte, readPosition, readRemaining, start, writeRemaining
assertReferencesReleased, backgroundPerformRelease, clearUsedByThread, createdHere, disableReferenceTracing, enableReferenceTracing, refCount, referenceId, release, releaseLast, reserve, reservedBy, reserveTransfer, singleThreadedCheckDisabled, singleThreadedCheckReset, threadSafetyCheck, throwExceptionIfNotReleased, throwExceptionIfReleased, tryReserve, unmonitor, warnAndReleaseIfNotReleased
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAndGetDouble, addAndGetDoubleNotAtomic, addAndGetFloat, addAndGetFloatNotAtomic, addAndGetInt, addAndGetIntNotAtomic, addAndGetLong, addAndGetShortNotAtomic, addAndGetUnsignedByteNotAtomic, byteCheckSum, byteCheckSum, bytesForRead, bytesForWrite, bytesStore, charAt, cipher, cipher, compareAndSwapDouble, compareAndSwapFloat, contentEquals, copyTo, copyTo, elasticByteBuffer, empty, endsWith, equalBytes, from, from, from, hash, inside, inside, isClear, isEmpty, isEqual, isImmutableEmptyByteStore, lazyNativeBytesStoreWithFixedCapacity, length, nativePointer, nativeStore, nativeStoreFrom, nativeStoreWithFixedCapacity, readWrite, realCapacity, safeLimit, startsWith, startsWith, subSequence, to8bitString, toDebugString, toDebugString, wrap, writeMaxInt, writeMaxLong, zeroOut
canReadDirect, 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
public static <T> HeapBytesStore<T> forFields(Object o, String groupName, int padding)
@NotNull public static @NotNull HeapBytesStore<byte[]> wrap(byte[] byteArray)
BytesStore
byteArray
- to wrap@NotNull public static @NotNull HeapBytesStore<ByteBuffer> wrap(@NotNull @NotNull ByteBuffer bb)
BytesStore
bb
- the ByteBuffer to wrappublic boolean isDirectMemory()
public void move(long from, long to, long length) throws BufferUnderflowException, ArithmeticException
@NotNull public @NotNull String toString()
toString
in interface CharSequence
toString
in class net.openhft.chronicle.core.io.AbstractReferenceCounted
@NotNull public @NotNull BytesStore<HeapBytesStore<U>,U> copy()
protected void performRelease()
performRelease
in class net.openhft.chronicle.core.io.AbstractReferenceCounted
public long capacity()
@NotNull public U underlyingObject()
public boolean compareAndSwapInt(long offset, int expected, int value)
RandomDataInput
offset
- to perform CASexpected
- valuevalue
- to setpublic void testAndSetInt(long offset, int expected, int value) throws IllegalStateException
IllegalStateException
public boolean compareAndSwapLong(long offset, long expected, long value)
RandomDataInput
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 Bytespublic long write8bit(long position, @NotNull @NotNull BytesStore bs)
RandomDataOutput
position
- to writebs
- to copy.RandomDataOutput
public long write8bit(long position, @NotNull @NotNull String s, int start, int length)
@NotNull public @NotNull HeapBytesStore<U> writeByte(long offset, byte b) throws BufferOverflowException
RandomDataOutput
offset
- to write tob
- the valueBufferOverflowException
- if the capacity was exceeded@NotNull public @NotNull HeapBytesStore<U> writeShort(long offset, short i16) throws BufferOverflowException
RandomDataOutput
offset
- to write toi16
- the valueBufferOverflowException
- if the capacity was exceeded@NotNull public @NotNull HeapBytesStore<U> writeInt(long offset, int i32) throws BufferOverflowException
RandomDataOutput
offset
- to write toi32
- the valueBufferOverflowException
- if the capacity was exceeded@NotNull public @NotNull HeapBytesStore<U> writeOrderedInt(long offset, int i32) throws BufferOverflowException
RandomDataOutput
offset
- to write toi32
- value to writeBufferOverflowException
- if the capacity was exceeded@NotNull public @NotNull HeapBytesStore<U> writeLong(long offset, long i64) throws BufferOverflowException
RandomDataOutput
offset
- to write toi64
- the valueBufferOverflowException
- if the capacity was exceeded@NotNull public @NotNull HeapBytesStore<U> writeOrderedLong(long offset, long i) throws BufferOverflowException
RandomDataOutput
offset
- to write toi
- value to writeBufferOverflowException
@NotNull public @NotNull HeapBytesStore<U> writeFloat(long offset, float f) throws BufferOverflowException
RandomDataOutput
offset
- to write tof
- the valueBufferOverflowException
- if the capacity was exceeded@NotNull public @NotNull HeapBytesStore<U> writeDouble(long offset, double d) throws BufferOverflowException
RandomDataOutput
offset
- to write tod
- the valueBufferOverflowException
- if the capacity was exceeded@NotNull public @NotNull HeapBytesStore<U> writeVolatileByte(long offset, byte i8) throws BufferOverflowException
BufferOverflowException
@NotNull public @NotNull HeapBytesStore<U> writeVolatileShort(long offset, short i16) throws BufferOverflowException
BufferOverflowException
@NotNull public @NotNull HeapBytesStore<U> writeVolatileInt(long offset, int i32) throws BufferOverflowException
BufferOverflowException
@NotNull public @NotNull HeapBytesStore<U> writeVolatileLong(long offset, long i64) throws BufferOverflowException
BufferOverflowException
@NotNull public @NotNull HeapBytesStore<U> write(long offsetInRDO, byte[] byteArray, int offset, int length) throws BufferOverflowException
RandomDataOutput
byteArray
to this Bytes object starting at writeOffset
taking
content starting at readOffset
but copying at most length
bytes.
Does not update cursors e.g. writePosition()
offsetInRDO
- non-negative offset to write tobyteArray
- non-null copy from byteArrayoffset
- non-negative copy from offsetlength
- non-negative length to copyBufferOverflowException
- if this Bytes object cannot accommodate all the bytes to copy.public void write(long offsetInRDO, @NotNull @NotNull ByteBuffer bytes, int offset, int length) throws BufferOverflowException
RandomDataOutput
Does not update cursors e.g. writePosition()
offsetInRDO
- offset to write tobytes
- copy from bytesoffset
- copy from offsetBufferOverflowException
@NotNull public @NotNull HeapBytesStore<U> write(long writeOffset, @NotNull @NotNull RandomDataInput bytes, long readOffset, long length) throws IllegalStateException, BufferUnderflowException, BufferOverflowException
RandomDataOutput
writePosition()
nor RandomCommon.readPosition()
writeOffset
- offset to write tobytes
- copy from bytesreadOffset
- copy from offsetIllegalStateException
BufferOverflowException
BufferUnderflowException
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 int hashCode()
hashCode
in class AbstractBytesStore<HeapBytesStore<U>,U>
public boolean equals(Object obj)
equals
in class AbstractBytesStore<HeapBytesStore<U>,U>
public long writePosition()
readPosition() <= writePosition() && writePosition() <= writeLimit()
If the resource is closed, the returned value is unspecified.
public long lengthWritten(long startPosition)
If the resource is closed, the returned value is unspecified.
startPosition
- to compare againstpublic long realReadRemaining()
If the resource is closed, the returned value is unspecified.
public long realWriteRemaining()
If the resource is closed, the returned value is unspecified.
public long readLimit()
If the resource is closed, the returned value is unspecified.
public long writeLimit()
If the resource is closed, the returned value is unspecified.
public long addressForRead(long offset, int buffer) throws UnsupportedOperationException, BufferUnderflowException, IllegalStateException
public ByteOrder byteOrder()
Copyright © 2022. All rights reserved.