public class NativeBytesStore<Underlying> extends AbstractBytesStore<NativeBytesStore<Underlying>,Underlying>
| Modifier and Type | Field and Description |
|---|---|
protected long |
address |
protected long |
maximumLimit |
protected net.openhft.chronicle.core.Memory |
memory |
protected Throwable |
releasedHere |
charToString| Constructor and Description |
|---|
NativeBytesStore(long address,
long maximumLimit) |
NativeBytesStore(long address,
long maximumLimit,
Runnable deallocator,
boolean elastic) |
| Modifier and Type | Method and Description |
|---|---|
long |
addressForRead(long offset)
Obtain the underlying addressForRead.
|
long |
addressForWrite(long offset)
Obtain the underlying addressForRead.
|
long |
appendUTF(long pos,
char[] chars,
int offset,
int length)
Deprecated.
|
long |
appendUtf8(long pos,
char[] chars,
int offset,
int length) |
int |
byteCheckSum()
Return the bytes sum of the readable bytes.
|
int |
byteCheckSum(long position,
long limit) |
default ByteOrder |
byteOrder() |
VanillaBytes<Underlying> |
bytesForWrite() |
long |
capacity() |
void |
checkReleased() |
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<NativeBytesStore<Underlying>,Underlying> |
copy() |
long |
copyTo(BytesStore store)
Copy the data to another BytesStore as long as there is space available in the destination store.
|
long |
copyToDirect(BytesStore store) |
static NativeBytesStore<ByteBuffer> |
elasticByteBuffer() |
static NativeBytesStore<ByteBuffer> |
elasticByteBuffer(int size,
long maxSize) |
boolean |
equals(Object obj) |
int |
fastHash(long offset,
int length) |
static NativeBytesStore |
from(byte[] bytes) |
static NativeBytesStore |
from(String text) |
void |
init(ByteBuffer bb,
boolean elastic) |
boolean |
isDirectMemory() |
static NativeBytesStore<Void> |
lazyNativeBytesStoreWithFixedCapacity(long capacity) |
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.
|
static NativeBytesStore<Void> |
nativeStore(long capacity)
this is an elastic native store
|
static NativeBytesStore<Void> |
nativeStoreWithFixedCapacity(long capacity) |
void |
nativeWrite(long address,
long position,
long size)
expert level method to copy data from native memory into the BytesStore
|
int |
peekUnsignedByte(long offset)
Read an unsigned byte at an offset, or -1
|
long |
read(long offsetInRDI,
byte[] bytes,
int offset,
int length) |
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
|
long |
readIncompleteLong(long offset)
Read a long which is zero padded (high bytes) if the available bytes is less than 8.
|
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.
|
long |
realCapacity() |
long |
refCount() |
void |
release() |
void |
reserve() |
long |
safeLimit() |
void |
setAddress(long address) |
boolean |
sharedMemory() |
String |
toString() |
ByteBuffer |
toTemporaryDirectByteBuffer() |
protected long |
translate(long offset) |
Underlying |
underlyingObject() |
void |
uninit() |
static <T> NativeBytesStore<T> |
uninitialized() |
static NativeBytesStore<ByteBuffer> |
wrap(ByteBuffer bb)
Wraps a ByteBuffer which can be either on heap or off heap.
|
NativeBytesStore<Underlying> |
write(long offsetInRDO,
byte[] bytes,
int offset,
int length) |
void |
write(long offsetInRDO,
ByteBuffer bytes,
int offset,
int length) |
NativeBytesStore<Underlying> |
write(long offsetInRDO,
RandomDataInput bytes,
long offset,
long length) |
void |
write0(long offsetInRDO,
RandomDataInput bytes,
long offset,
long length) |
NativeBytesStore<Underlying> |
writeByte(long offset,
byte i8)
Write an unsigned byte at an offset.
|
NativeBytesStore<Underlying> |
writeDouble(long offset,
double d)
Write a double at an offset.
|
NativeBytesStore<Underlying> |
writeFloat(long offset,
float f)
Write a float at an offset.
|
NativeBytesStore<Underlying> |
writeInt(long offset,
int i32)
Write an int at an offset.
|
default long |
writeLimit() |
NativeBytesStore<Underlying> |
writeLong(long offset,
long i64)
Write a long at an offset.
|
NativeBytesStore<Underlying> |
writeOrderedInt(long offset,
int i)
Perform a non stalling write with a store barrier.
|
NativeBytesStore<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() |
NativeBytesStore<Underlying> |
writeShort(long offset,
short i16)
Write a short at an offset.
|
NativeBytesStore<Underlying> |
writeVolatileByte(long offset,
byte i8) |
NativeBytesStore<Underlying> |
writeVolatileInt(long offset,
int i32) |
NativeBytesStore<Underlying> |
writeVolatileLong(long offset,
long i64) |
NativeBytesStore<Underlying> |
writeVolatileShort(long offset,
short i16) |
NativeBytesStore<Underlying> |
zeroOut(long start,
long end)
Fill the BytesStore with zeros
|
hashCode, readPosition, readRemaining, startclone, finalize, getClass, notify, notifyAll, wait, wait, waitaddAndGetByteNotAtomic, addAndGetDoubleNotAtomic, addAndGetFloatNotAtomic, addAndGetIntNotAtomic, addAndGetLongNotAtomic, addAndGetShortNotAtomic, addAndGetUnsignedByteNotAtomic, addAndGetUnsignedIntNotAtomic, addAndGetUnsignedShortNotAtomic, bytesForRead, bytesStore, charAt, cipher, cipher, contentEquals, copyTo, empty, endsWith, equalBytes, from, inside, isClear, isEmpty, isPresent, isPresent, length, longCheckSum, nativePointer, readWrite, startsWith, startsWith, subSequence, to8bitString, toDebugString, toDebugString, wrap, wrap, writeMaxLongaddAndGetDouble, addAndGetFloat, addAndGetInt, addAndGetLong, compareUtf8, copyTo, copyTo, createCharToString, findByte, parseLong, peekVolatileInt, printable, readBoolean, readUnsignedByte, readUnsignedInt, readUnsignedInt24, readUnsignedShort, readUtf8, readUtf8Limited, readUtf8Limited, readVolatileDouble, readVolatileFloat, subBytes, toByteArrayappend, append, write, write, writeBoolean, writeByte, writeInt24, writeOrderedDouble, writeOrderedFloat, writeUnsignedByte, writeUnsignedInt, writeUnsignedShort, writeUtf8, writeUtf8Limited, writeVolatileDouble, writeVolatileFloatrelease, releaseAll, tryReservechars, codePointsprotected long address
@NotNull protected net.openhft.chronicle.core.Memory memory
protected volatile Throwable releasedHere
protected long maximumLimit
public NativeBytesStore(long address,
long maximumLimit)
public NativeBytesStore(long address,
long maximumLimit,
@Nullable
Runnable deallocator,
boolean elastic)
@NotNull public static NativeBytesStore<ByteBuffer> wrap(@NotNull ByteBuffer bb)
BytesStorebb - to wrap@NotNull public static <T> NativeBytesStore<T> uninitialized()
@NotNull public static NativeBytesStore<Void> nativeStore(long capacity) throws IllegalArgumentException
capacity - of the buffer.IllegalArgumentException@NotNull public static NativeBytesStore<Void> nativeStoreWithFixedCapacity(long capacity) throws IllegalArgumentException
IllegalArgumentException@NotNull public static NativeBytesStore<Void> lazyNativeBytesStoreWithFixedCapacity(long capacity) throws IllegalArgumentException
IllegalArgumentException@NotNull public static NativeBytesStore<ByteBuffer> elasticByteBuffer()
@NotNull public static NativeBytesStore<ByteBuffer> elasticByteBuffer(int size, long maxSize)
@NotNull public static NativeBytesStore from(@NotNull String text)
@NotNull public static NativeBytesStore from(@NotNull byte[] bytes)
public boolean isDirectMemory()
public void init(@NotNull
ByteBuffer bb,
boolean elastic)
public void uninit()
public void move(long from,
long to,
long length)
throws BufferUnderflowException
BufferUnderflowException@NotNull public BytesStore<NativeBytesStore<Underlying>,Underlying> copy()
@NotNull public VanillaBytes<Underlying> bytesForWrite() throws IllegalStateException
IllegalStateExceptionpublic long realCapacity()
public long capacity()
@Nullable public Underlying underlyingObject()
@NotNull public NativeBytesStore<Underlying> zeroOut(long start, long end)
BytesStorestart - first byte inclusiveend - last byte exclusive.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 setprotected long translate(long offset)
public void reserve()
throws IllegalStateException
IllegalStateExceptionpublic void release()
throws IllegalStateException
IllegalStateExceptionpublic long refCount()
public byte readByte(long offset)
RandomDataInputoffset - to readpublic void checkReleased()
public short readShort(long offset)
RandomDataInputoffset - to readpublic int readInt(long offset)
RandomDataInputoffset - to readpublic long readLong(long offset)
RandomDataInputoffset - to readpublic float readFloat(long offset)
RandomDataInputoffset - to readpublic double readDouble(long offset)
RandomDataInputoffset - to readpublic byte readVolatileByte(long offset)
RandomDataInputoffset - to readpublic short readVolatileShort(long offset)
RandomDataInputoffset - to readpublic int readVolatileInt(long offset)
RandomDataInputoffset - to readpublic long readVolatileLong(long offset)
RandomDataInputoffset - to read@NotNull public NativeBytesStore<Underlying> writeByte(long offset, byte i8)
RandomDataOutputoffset - to write toi8 - the value@NotNull public NativeBytesStore<Underlying> writeShort(long offset, short i16)
RandomDataOutputoffset - to write toi16 - the value@NotNull public NativeBytesStore<Underlying> writeInt(long offset, int i32)
RandomDataOutputoffset - to write toi32 - the value@NotNull public NativeBytesStore<Underlying> writeOrderedInt(long offset, int i)
RandomDataOutputoffset - to write toi - value to write@NotNull public NativeBytesStore<Underlying> writeLong(long offset, long i64)
RandomDataOutputoffset - to write toi64 - the value@NotNull public NativeBytesStore<Underlying> writeOrderedLong(long offset, long i)
RandomDataOutputoffset - to write toi - value to write@NotNull public NativeBytesStore<Underlying> writeFloat(long offset, float f)
RandomDataOutputoffset - to write tof - the value@NotNull public NativeBytesStore<Underlying> writeDouble(long offset, double d)
RandomDataOutputoffset - to write tod - the value@NotNull public NativeBytesStore<Underlying> writeVolatileByte(long offset, byte i8)
@NotNull public NativeBytesStore<Underlying> writeVolatileShort(long offset, short i16)
@NotNull public NativeBytesStore<Underlying> writeVolatileInt(long offset, int i32)
@NotNull public NativeBytesStore<Underlying> writeVolatileLong(long offset, long i64)
@NotNull public NativeBytesStore<Underlying> write(long offsetInRDO, byte[] bytes, int offset, int length)
public void write(long offsetInRDO,
@NotNull
ByteBuffer bytes,
int offset,
int length)
@NotNull public NativeBytesStore<Underlying> write(long offsetInRDO, @NotNull RandomDataInput bytes, long offset, long length) throws BufferOverflowException, BufferUnderflowException
public void write0(long offsetInRDO,
@NotNull
RandomDataInput bytes,
long offset,
long length)
throws BufferUnderflowException
BufferUnderflowExceptionpublic long addressForRead(long offset)
throws BufferUnderflowException
offset - within this buffer. addressForRead(start()) is the actual addressForRead of the first byte.BufferUnderflowException - if the offset is before the start() or the after the capacity()public long addressForWrite(long offset)
throws BufferOverflowException
offset - within this buffer. addressForRead(start()) is the actual addressForRead of the first byte.BufferOverflowException - if the offset is before the start() or the after the capacity()@NotNull public String toString()
toString in interface CharSequencetoString in class Objectpublic void nativeRead(long position,
long address,
long size)
throws BufferUnderflowException
RandomDataInputposition - within the ByteStore to copy.address - in native memorysize - in bytesBufferUnderflowException - if the offset is outside the limits of the Bytespublic void nativeWrite(long address,
long position,
long size)
throws BufferOverflowException
RandomDataOutputaddress - in native memory to copy fromposition - in BytesStore to copy tosize - in bytesBufferOverflowExceptionpublic long readIncompleteLong(long offset)
RandomDataInputoffset - to read frompublic void setAddress(long address)
@Deprecated public long appendUTF(long pos, char[] chars, int offset, int length) throws BufferOverflowException
BufferOverflowExceptionpublic long appendUtf8(long pos,
char[] chars,
int offset,
int length)
throws BufferOverflowException
BufferOverflowExceptionpublic long copyTo(@NotNull
BytesStore store)
BytesStorestore - to copy topublic long copyToDirect(@NotNull
BytesStore store)
@NotNull public ByteBuffer toTemporaryDirectByteBuffer()
public int byteCheckSum()
throws net.openhft.chronicle.core.io.IORuntimeException
BytesStorenet.openhft.chronicle.core.io.IORuntimeExceptionpublic int byteCheckSum(long position,
long limit)
public boolean sharedMemory()
public long read(long offsetInRDI,
byte[] bytes,
int offset,
int length)
public int peekUnsignedByte(long offset)
RandomDataInputpeekUnsignedByte in interface RandomDataInputpeekUnsignedByte in class AbstractBytesStore<NativeBytesStore<Underlying>,Underlying>offset - to readpublic int fastHash(long offset,
int length)
throws BufferUnderflowException
BufferUnderflowExceptionpublic long safeLimit()
public long writePosition()
public long writeRemaining()
public long readLimit()
public long writeLimit()
public ByteOrder byteOrder()
public boolean compareAndSwapFloat(long offset,
float expected,
float value)
throws BufferOverflowException
offset - to perform CASexpected - valuevalue - to setBufferOverflowExceptionpublic boolean compareAndSwapDouble(long offset,
double expected,
double value)
throws BufferOverflowException
offset - to perform CASexpected - valuevalue - to setBufferOverflowExceptionCopyright © 2018. All rights reserved.