public class HeapBytesStore<Underlying> extends Object implements BytesStore<HeapBytesStore<Underlying>,Underlying>
charToString
Modifier and Type | Method and Description |
---|---|
long |
address(long offset)
Obtain the underlying address.
|
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.
|
BytesStore<HeapBytesStore<Underlying>,Underlying> |
copy() |
boolean |
equals(Object obj) |
void |
init(byte[] byteArray) |
void |
init(ByteBuffer byteBuffer) |
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
|
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
|
default long |
readPosition()
The read position must be start() <= readPosition() && readPosition() <= readLimit() && readPosition < safeLimit()
|
default long |
readRemaining() |
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.
|
long |
refCount() |
void |
release() |
void |
reserve() |
default long |
start() |
String |
toString() |
Underlying |
underlyingObject() |
void |
uninit() |
static <T> HeapBytesStore<T> |
uninitialized() |
HeapBytesStore<Underlying> |
write(long offsetInRDO,
byte[] bytes,
int offset,
int length) |
void |
write(long offsetInRDO,
ByteBuffer bytes,
int offset,
int length) |
HeapBytesStore<Underlying> |
write(long offsetInRDO,
RandomDataInput bytes,
long offset,
long length) |
HeapBytesStore<Underlying> |
writeByte(long offset,
byte b)
Write an unsigned byte at an offset.
|
HeapBytesStore<Underlying> |
writeDouble(long offset,
double d)
Write a double at an offset.
|
HeapBytesStore<Underlying> |
writeFloat(long offset,
float f)
Write a float at an offset.
|
HeapBytesStore<Underlying> |
writeInt(long offset,
int i32)
Write an int at an offset.
|
default long |
writeLimit() |
HeapBytesStore<Underlying> |
writeLong(long offset,
long i64)
Write a long at an offset.
|
HeapBytesStore<Underlying> |
writeOrderedInt(long offset,
int i32)
Perform a non stalling write with a store barrier.
|
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() |
HeapBytesStore<Underlying> |
writeShort(long offset,
short i16)
Write a short at an offset.
|
HeapBytesStore<Underlying> |
writeVolatileByte(long offset,
byte i8) |
HeapBytesStore<Underlying> |
writeVolatileInt(long offset,
int i32) |
HeapBytesStore<Underlying> |
writeVolatileLong(long offset,
long i64) |
HeapBytesStore<Underlying> |
writeVolatileShort(long offset,
short i16) |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addAndGetByteNotAtomic, addAndGetDoubleNotAtomic, addAndGetFloatNotAtomic, addAndGetIntNotAtomic, addAndGetLongNotAtomic, addAndGetShortNotAtomic, addAndGetUnsignedByteNotAtomic, addAndGetUnsignedIntNotAtomic, addAndGetUnsignedShortNotAtomic, byteCheckSum, bytesForRead, bytesForWrite, bytesStore, charAt, contentEquals, copyTo, copyTo, endsWith, equalBytes, from, inside, isClear, length, longCheckSum, nativePointer, realCapacity, safeLimit, startsWith, subSequence, to8bitString, toDebugString, toDebugString, wrap, wrap, zeroOut
addAndGetDouble, addAndGetFloat, addAndGetInt, addAndGetLong, compareUtf8, copyTo, copyTo, createCharToString, findByte, parseLong, printable, read, readBoolean, readIncompleteLong, readUnsignedByte, readUnsignedInt, readUnsignedShort, readUtf8, readUtf8Limited, readUtf8Limited, readVolatileDouble, readVolatileFloat, subBytes, toByteArray, toTemporaryDirectByteBuffer
append, write, write, writeBoolean, writeByte, writeOrderedDouble, writeOrderedFloat, writeUnsignedByte, writeUnsignedInt, writeUnsignedShort, writeUtf8, writeUtf8Limited, writeVolatileDouble, writeVolatileFloat
close, release, releaseAll, tryReserve
closeQuietly, notifyClosing
chars, codePoints
public void init(@NotNull ByteBuffer byteBuffer)
public void init(@NotNull byte[] byteArray)
public void uninit()
public static <T> HeapBytesStore<T> uninitialized()
@NotNull public String toString()
toString
in interface CharSequence
toString
in class Object
@NotNull public BytesStore<HeapBytesStore<Underlying>,Underlying> copy()
copy
in interface BytesStore<HeapBytesStore<Underlying>,Underlying>
public void reserve()
reserve
in interface net.openhft.chronicle.core.ReferenceCounted
public void release()
release
in interface net.openhft.chronicle.core.ReferenceCounted
public long refCount()
refCount
in interface net.openhft.chronicle.core.ReferenceCounted
public long capacity()
capacity
in interface BytesStore<HeapBytesStore<Underlying>,Underlying>
@NotNull public Underlying underlyingObject()
underlyingObject
in interface BytesStore<HeapBytesStore<Underlying>,Underlying>
public boolean compareAndSwapInt(long offset, int expected, int value)
offset
- to perform CASexpected
- valuevalue
- to setpublic boolean compareAndSwapLong(long offset, long expected, long value)
offset
- to perform CASexpected
- valuevalue
- to setpublic byte readByte(long offset) throws BufferUnderflowException
RandomDataInput
readByte
in interface RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the Bytespublic short readShort(long offset) throws BufferUnderflowException
RandomDataInput
readShort
in interface RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the Bytespublic int readInt(long offset) throws BufferUnderflowException
RandomDataInput
readInt
in interface RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the Bytespublic long readLong(long offset) throws BufferUnderflowException
RandomDataInput
readLong
in interface RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the Bytespublic float readFloat(long offset) throws BufferUnderflowException
RandomDataInput
readFloat
in interface RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the Bytespublic double readDouble(long offset) throws BufferUnderflowException
RandomDataInput
readDouble
in interface RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the Bytespublic byte readVolatileByte(long offset) throws BufferUnderflowException
RandomDataInput
readVolatileByte
in interface RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the Bytespublic short readVolatileShort(long offset) throws BufferUnderflowException
RandomDataInput
readVolatileShort
in interface RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the Bytespublic int readVolatileInt(long offset) throws BufferUnderflowException
RandomDataInput
readVolatileInt
in interface RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the Bytespublic long readVolatileLong(long offset) throws BufferUnderflowException
RandomDataInput
readVolatileLong
in interface RandomDataInput
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the Bytes@NotNull public HeapBytesStore<Underlying> writeByte(long offset, byte b) throws BufferOverflowException
RandomDataOutput
writeByte
in interface RandomDataOutput<HeapBytesStore<Underlying>>
offset
- to write tob
- the valueBufferOverflowException
- if the capacity was exceeded@NotNull public HeapBytesStore<Underlying> writeShort(long offset, short i16) throws BufferOverflowException
RandomDataOutput
writeShort
in interface RandomDataOutput<HeapBytesStore<Underlying>>
offset
- to write toi16
- the valueBufferOverflowException
- if the capacity was exceeded@NotNull public HeapBytesStore<Underlying> writeInt(long offset, int i32) throws BufferOverflowException
RandomDataOutput
writeInt
in interface RandomDataOutput<HeapBytesStore<Underlying>>
offset
- to write toi32
- the valueBufferOverflowException
- if the capacity was exceeded@NotNull public HeapBytesStore<Underlying> writeOrderedInt(long offset, int i32) throws BufferOverflowException
RandomDataOutput
writeOrderedInt
in interface RandomDataOutput<HeapBytesStore<Underlying>>
offset
- to write toi32
- value to writeBufferOverflowException
- if the capacity was exceeded@NotNull public HeapBytesStore<Underlying> writeLong(long offset, long i64) throws BufferOverflowException
RandomDataOutput
writeLong
in interface RandomDataOutput<HeapBytesStore<Underlying>>
offset
- to write toi64
- the valueBufferOverflowException
- if the capacity was exceeded@NotNull public HeapBytesStore<Underlying> writeOrderedLong(long offset, long i) throws BufferOverflowException
RandomDataOutput
writeOrderedLong
in interface RandomDataOutput<HeapBytesStore<Underlying>>
offset
- to write toi
- value to writeBufferOverflowException
@NotNull public HeapBytesStore<Underlying> writeFloat(long offset, float f) throws BufferOverflowException
RandomDataOutput
writeFloat
in interface RandomDataOutput<HeapBytesStore<Underlying>>
offset
- to write tof
- the valueBufferOverflowException
- if the capacity was exceeded@NotNull public HeapBytesStore<Underlying> writeDouble(long offset, double d) throws BufferOverflowException
RandomDataOutput
writeDouble
in interface RandomDataOutput<HeapBytesStore<Underlying>>
offset
- to write tod
- the valueBufferOverflowException
- if the capacity was exceededpublic HeapBytesStore<Underlying> writeVolatileByte(long offset, byte i8) throws BufferOverflowException
writeVolatileByte
in interface RandomDataOutput<HeapBytesStore<Underlying>>
BufferOverflowException
public HeapBytesStore<Underlying> writeVolatileShort(long offset, short i16) throws BufferOverflowException
writeVolatileShort
in interface RandomDataOutput<HeapBytesStore<Underlying>>
BufferOverflowException
public HeapBytesStore<Underlying> writeVolatileInt(long offset, int i32) throws BufferOverflowException
writeVolatileInt
in interface RandomDataOutput<HeapBytesStore<Underlying>>
BufferOverflowException
public HeapBytesStore<Underlying> writeVolatileLong(long offset, long i64) throws BufferOverflowException
writeVolatileLong
in interface RandomDataOutput<HeapBytesStore<Underlying>>
BufferOverflowException
@NotNull public HeapBytesStore<Underlying> write(long offsetInRDO, byte[] bytes, int offset, int length) throws BufferOverflowException
write
in interface RandomDataOutput<HeapBytesStore<Underlying>>
BufferOverflowException
public void write(long offsetInRDO, @NotNull ByteBuffer bytes, int offset, int length) throws BufferOverflowException
write
in interface RandomDataOutput<HeapBytesStore<Underlying>>
BufferOverflowException
@NotNull public HeapBytesStore<Underlying> write(long offsetInRDO, RandomDataInput bytes, long offset, long length)
write
in interface RandomDataOutput<HeapBytesStore<Underlying>>
public long address(long offset) throws UnsupportedOperationException
offset
- within this buffer. address(start()) is the actual address of the first byte.UnsupportedOperationException
- if the underlying buffer is on the heappublic void nativeRead(long position, long address, long size)
RandomDataInput
nativeRead
in interface RandomDataInput
position
- within the ByteStore to copy.address
- in native memorysize
- in bytespublic void nativeWrite(long address, long position, long size)
RandomDataOutput
nativeWrite
in interface RandomDataOutput<HeapBytesStore<Underlying>>
address
- in native memory to copy fromposition
- in BytesStore to copy tosize
- in bytespublic long start()
public long readPosition()
public long writePosition()
public long readRemaining()
public long writeRemaining()
public long readLimit()
public long writeLimit()
public ByteOrder byteOrder()
public boolean compareAndSwapFloat(long offset, float expected, float value) throws BufferOverflowException, IllegalArgumentException, IORuntimeException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
IllegalArgumentException
IORuntimeException
public boolean compareAndSwapDouble(long offset, double expected, double value) throws BufferOverflowException, IllegalArgumentException, IORuntimeException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
IllegalArgumentException
IORuntimeException
Copyright © 2015. All rights reserved.