public interface RandomDataInput
| Modifier and Type | Field and Description |
|---|---|
static String[] |
charToString |
| Modifier and Type | Method and Description |
|---|---|
default double |
addAndGetDouble(long offset,
double adding)
Perform an atomic add and get operation for a 64-bit double
|
default float |
addAndGetFloat(long offset,
float adding)
Perform an atomic add and get operation for a 32-bit float
|
default int |
addAndGetInt(long offset,
int adding)
Perform an atomic add and get operation for a 32-bit int
|
default long |
addAndGetLong(long offset,
long adding)
Perform an atomic add and get operation for a 64-bit long
|
long |
address(long offset)
Obtain the underlying address.
|
default ByteOrder |
byteOrder() |
Bytes |
bytesForRead() |
Bytes |
bytesForWrite() |
default 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.
|
default boolean |
compareUtf8(long offset,
CharSequence other)
Compares the UTF-8 encoded char sequence, written in this
RandomDataInput at the
given offset, with the given char sequence. |
default int |
copyTo(byte[] bytes)
Read a byte[] from memory.
|
default int |
copyTo(ByteBuffer bb) |
static String[] |
createCharToString() |
default int |
fastHash(long offset,
int length) |
default int |
findByte(byte stopByte) |
boolean |
isNative() |
void |
nativeRead(long position,
long address,
long size)
expert level method for copying data to native memory.
|
default long |
parseLong(long offset) |
default String |
printable(long offset)
Read the byte at an offset and converts it into a printable
|
default long |
read(long offsetInRDI,
byte[] bytes,
int offset,
int length) |
default boolean |
readBoolean(long offset)
Read boolean at an offset
|
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
|
default 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
|
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
|
default int |
readUnsignedByte(long offset)
Read an unsigned byte at an offset
|
default long |
readUnsignedInt(long offset)
Read an unsigned int at an offset
|
default int |
readUnsignedInt24(long offset)
Read an unsigned int at an offset
|
default int |
readUnsignedShort(long offset)
Read an unsigned short at an offset
|
default <ACS extends Appendable & CharSequence> |
readUtf8(long offset,
ACS sb)
Truncates
sb (it must be a StringBuilder or Bytes) and reads a char
sequence from the given offset, encoded as Utf8, into it. |
default <ACS extends Appendable & CharSequence> |
readUtf8Limited(long offset,
ACS sb,
int maxUtf8Len)
Truncates
sb (it must be a StringBuilder or Bytes) and reads a char
sequence from the given offset, encoded as Utf8, into it. |
default String |
readUtf8Limited(long offset,
int maxUtf8Len)
Reads a char sequence from the given
offset, encoded as Utf8. |
default byte |
readVolatileByte(long offset)
Read a 8-bit byte from memory with a load barrier.
|
default double |
readVolatileDouble(long offset)
Read a 64-bit double from memory with a load barrier.
|
default float |
readVolatileFloat(long offset)
Read a float from memory with a load barrier.
|
default int |
readVolatileInt(long offset)
Read a 32-bit int from memory with a load barrier.
|
default long |
readVolatileLong(long offset)
Read a 64-bit long from memory with a load barrier.
|
default short |
readVolatileShort(long offset)
Read a 16-bit short from memory with a load barrier.
|
long |
realCapacity() |
boolean |
sharedMemory() |
default long |
start() |
default BytesStore |
subBytes(long start,
long length)
Copy a sub sequence of bytes as a BytesStore.
|
default byte[] |
toByteArray() |
default ByteBuffer |
toTemporaryDirectByteBuffer() |
default long |
writeLimit() |
default long |
writePosition()
The read position must be readPosition() <= writePosition() && writePosition() <= writeLimit()
|
default long |
writeRemaining() |
static final String[] charToString
@NotNull static String[] createCharToString()
default boolean readBoolean(long offset)
throws BufferUnderflowException,
net.openhft.chronicle.core.io.IORuntimeException
offset - to readBufferUnderflowException - if the offset is outside the limits of the BytesIORuntimeException - if an error occurred trying to obtain the data.net.openhft.chronicle.core.io.IORuntimeExceptionbyte readByte(long offset)
throws BufferUnderflowException,
net.openhft.chronicle.core.io.IORuntimeException
offset - to readBufferUnderflowException - if the offset is outside the limits of the BytesIORuntimeException - if an error occurred trying to obtain the data.net.openhft.chronicle.core.io.IORuntimeExceptiondefault int readUnsignedByte(long offset)
throws BufferUnderflowException,
net.openhft.chronicle.core.io.IORuntimeException
offset - to readBufferUnderflowException - if the offset is outside the limits of the BytesIORuntimeException - if an error occurred trying to obtain the data.net.openhft.chronicle.core.io.IORuntimeExceptionshort readShort(long offset)
throws BufferUnderflowException,
net.openhft.chronicle.core.io.IORuntimeException
offset - to readBufferUnderflowException - if the offset is outside the limits of the BytesIORuntimeException - if an error occurred trying to obtain the data.net.openhft.chronicle.core.io.IORuntimeExceptiondefault int readUnsignedShort(long offset)
throws BufferUnderflowException,
net.openhft.chronicle.core.io.IORuntimeException
offset - to readBufferUnderflowException - if the offset is outside the limits of the BytesIORuntimeException - if an error occurred trying to obtain the data.net.openhft.chronicle.core.io.IORuntimeExceptiondefault int readUnsignedInt24(long offset)
throws BufferUnderflowException,
net.openhft.chronicle.core.io.IORuntimeException
offset - to readBufferUnderflowException - if the offset is outside the limits of the BytesIORuntimeException - if an error occurred trying to obtain the data.net.openhft.chronicle.core.io.IORuntimeExceptionint readInt(long offset)
throws BufferUnderflowException,
net.openhft.chronicle.core.io.IORuntimeException
offset - to readBufferUnderflowException - if the offset is outside the limits of the BytesIORuntimeException - if an error occurred trying to obtain the data.net.openhft.chronicle.core.io.IORuntimeExceptiondefault long readUnsignedInt(long offset)
throws BufferUnderflowException,
net.openhft.chronicle.core.io.IORuntimeException
offset - to readBufferUnderflowException - if the offset is outside the limits of the BytesIORuntimeException - if an error occurred trying to obtain the data.net.openhft.chronicle.core.io.IORuntimeExceptionlong readLong(long offset)
throws BufferUnderflowException,
net.openhft.chronicle.core.io.IORuntimeException
offset - to readBufferUnderflowException - if the offset is outside the limits of the BytesIORuntimeException - if an error occurred trying to obtain the data.net.openhft.chronicle.core.io.IORuntimeExceptionfloat readFloat(long offset)
throws BufferUnderflowException,
net.openhft.chronicle.core.io.IORuntimeException
offset - to readBufferUnderflowException - if the offset is outside the limits of the BytesIORuntimeException - if an error occurred trying to obtain the data.net.openhft.chronicle.core.io.IORuntimeExceptiondouble readDouble(long offset)
throws BufferUnderflowException,
net.openhft.chronicle.core.io.IORuntimeException
offset - to readBufferUnderflowException - if the offset is outside the limits of the BytesIORuntimeException - if an error occurred trying to obtain the data.net.openhft.chronicle.core.io.IORuntimeExceptiondefault String printable(long offset) throws BufferUnderflowException, net.openhft.chronicle.core.io.IORuntimeException
offset - to readBufferUnderflowException - if the offset is outside the limits of the BytesIORuntimeException - if an error occurred trying to obtain the data.net.openhft.chronicle.core.io.IORuntimeExceptiondefault byte readVolatileByte(long offset)
throws BufferUnderflowException,
net.openhft.chronicle.core.io.IORuntimeException
offset - to readBufferUnderflowException - if the offset is outside the limits of the BytesIORuntimeException - if an error occurred trying to obtain the data.net.openhft.chronicle.core.io.IORuntimeExceptiondefault short readVolatileShort(long offset)
throws BufferUnderflowException,
net.openhft.chronicle.core.io.IORuntimeException
offset - to readBufferUnderflowException - if the offset is outside the limits of the BytesIORuntimeException - if an error occurred trying to obtain the data.net.openhft.chronicle.core.io.IORuntimeExceptiondefault int readVolatileInt(long offset)
throws BufferUnderflowException,
net.openhft.chronicle.core.io.IORuntimeException
offset - to readBufferUnderflowException - if the offset is outside the limits of the BytesIORuntimeException - if an error occurred trying to obtain the data.net.openhft.chronicle.core.io.IORuntimeExceptiondefault float readVolatileFloat(long offset)
throws BufferUnderflowException,
net.openhft.chronicle.core.io.IORuntimeException
offset - to readBufferUnderflowException - if the offset is outside the limits of the BytesIORuntimeException - if an error occurred trying to obtain the data.net.openhft.chronicle.core.io.IORuntimeExceptiondefault long readVolatileLong(long offset)
throws BufferUnderflowException,
net.openhft.chronicle.core.io.IORuntimeException
offset - to readBufferUnderflowException - if the offset is outside the limits of the BytesIORuntimeException - if an error occurred trying to obtain the data.net.openhft.chronicle.core.io.IORuntimeExceptiondefault double readVolatileDouble(long offset)
throws BufferUnderflowException,
net.openhft.chronicle.core.io.IORuntimeException
offset - to readBufferUnderflowException - if the offset is outside the limits of the BytesIORuntimeException - if an error occurred trying to obtain the data.net.openhft.chronicle.core.io.IORuntimeExceptiondefault long parseLong(long offset)
throws BufferUnderflowException,
net.openhft.chronicle.core.io.IORuntimeException
BufferUnderflowExceptionnet.openhft.chronicle.core.io.IORuntimeExceptionvoid nativeRead(long position,
long address,
long size)
position - within the ByteStore to copy.address - in native memorysize - in bytesBufferUnderflowException - if the offset is outside the limits of the BytesIORuntimeException - if an error occurred trying to obtain the data.default int copyTo(@NotNull
byte[] bytes)
throws BufferUnderflowException,
net.openhft.chronicle.core.io.IORuntimeException
BufferUnderflowException - if the offset is outside the limits of the BytesIORuntimeException - if an error occurred trying to obtain the data.net.openhft.chronicle.core.io.IORuntimeExceptiondefault int copyTo(@NotNull
ByteBuffer bb)
throws BufferUnderflowException,
net.openhft.chronicle.core.io.IORuntimeException
BufferUnderflowExceptionnet.openhft.chronicle.core.io.IORuntimeExceptiondefault long readIncompleteLong(long offset)
throws net.openhft.chronicle.core.io.IORuntimeException
offset - to read fromIORuntimeException - if an error occurred trying to obtain the data.net.openhft.chronicle.core.io.IORuntimeExceptionlong realCapacity()
default int addAndGetInt(long offset,
int adding)
throws net.openhft.chronicle.core.io.IORuntimeException,
BufferUnderflowException
offset - to add and getadding - value to add, can be 1BufferUnderflowException - if the offset is outside the limits of the BytesIORuntimeException - if an error occurred trying to obtain the data.net.openhft.chronicle.core.io.IORuntimeExceptiondefault long addAndGetLong(long offset,
long adding)
throws net.openhft.chronicle.core.io.IORuntimeException,
BufferUnderflowException
offset - to add and getadding - value to add, can be 1BufferUnderflowException - if the offset is outside the limits of the BytesIORuntimeException - if an error occurred trying to obtain the data.net.openhft.chronicle.core.io.IORuntimeExceptiondefault float addAndGetFloat(long offset,
float adding)
throws net.openhft.chronicle.core.io.IORuntimeException,
BufferUnderflowException
offset - to add and getadding - value to add, can be 1BufferUnderflowException - if the offset is outside the limits of the BytesIORuntimeException - if an error occurred trying to obtain the data.net.openhft.chronicle.core.io.IORuntimeExceptiondefault double addAndGetDouble(long offset,
double adding)
throws net.openhft.chronicle.core.io.IORuntimeException,
BufferUnderflowException
offset - to add and getadding - value to add, can be 1BufferUnderflowException - if the offset is outside the limits of the BytesIORuntimeException - if an error occurred trying to obtain the data.net.openhft.chronicle.core.io.IORuntimeExceptiondefault BytesStore subBytes(long start, long length)
start - of byteslength - of bytesdefault int findByte(byte stopByte)
default <ACS extends Appendable & CharSequence> long readUtf8(long offset, @NotNull ACS sb) throws net.openhft.chronicle.core.io.IORuntimeException, IllegalArgumentException, BufferUnderflowException
sb (it must be a StringBuilder or Bytes) and reads a char
sequence from the given offset, encoded as Utf8, into it. Returns offset after
the read Utf8, if a normal char sequence was read, or -1 - offset, if null
was observed (in this case, sb is truncated too, but not updated then, by querying
sb only this case is indistinguishable from reading an empty char sequence).ACS - buffer type, must be StringBuilder or Bytesoffset - the offset in this RandomDataInput to read char sequence fromsb - the buffer to read char sequence into (truncated first)nullnet.openhft.chronicle.core.io.IORuntimeExceptionIllegalArgumentExceptionBufferUnderflowExceptionRandomDataOutput.writeUtf8(long, CharSequence)default <ACS extends Appendable & CharSequence> long readUtf8Limited(long offset, @NotNull ACS sb, int maxUtf8Len) throws net.openhft.chronicle.core.io.IORuntimeException, IllegalArgumentException, BufferUnderflowException, IllegalStateException
sb (it must be a StringBuilder or Bytes) and reads a char
sequence from the given offset, encoded as Utf8, into it. Returns offset after
the read Utf8, if a normal char sequence was read, or -1 - offset, if null
was observed (in this case, sb is truncated too, but not updated then, by querying
sb only this case is indistinguishable from reading an empty char sequence). If
length of Utf8 encoding of the char sequence exceeds maxUtf8Len,
IllegalStateException is thrown.ACS - buffer type, must be StringBuilder or Bytesoffset - the offset in this RandomDataInput to read char sequence fromsb - the buffer to read char sequence into (truncated first)maxUtf8Len - the maximum allowed length of the char sequence in Utf8 encodingnullnet.openhft.chronicle.core.io.IORuntimeExceptionIllegalArgumentExceptionBufferUnderflowExceptionIllegalStateExceptionRandomDataOutput.writeUtf8Limited(long, CharSequence, int)@Nullable default String readUtf8Limited(long offset, int maxUtf8Len) throws BufferUnderflowException, net.openhft.chronicle.core.io.IORuntimeException, IllegalArgumentException, IllegalStateException
offset, encoded as Utf8. If length of Utf8
encoding of the char sequence exceeds maxUtf8Len, IllegalStateException
is thrown.offset - the offset in this RandomDataInput to read char sequence frommaxUtf8Len - the maximum allowed length of the char sequence in Utf8 encodingBufferUnderflowExceptionnet.openhft.chronicle.core.io.IORuntimeExceptionIllegalArgumentExceptionIllegalStateExceptionRandomDataOutput.writeUtf8Limited(long, CharSequence, int)default boolean compareUtf8(long offset,
@Nullable
CharSequence other)
RandomDataInput at the
given offset, with the given char sequence. Returns true, if they are equal. Both
char sequences (encoded in bytes and the given) may be null.offset - the offset in this RandomDataInput where the char sequence to compare
is writtenother - the second char sequence to comparetrue if two char sequences are equaldefault byte[] toByteArray()
throws net.openhft.chronicle.core.io.IORuntimeException,
IllegalArgumentException
net.openhft.chronicle.core.io.IORuntimeExceptionIllegalArgumentExceptiondefault long read(long offsetInRDI,
byte[] bytes,
int offset,
int length)
default ByteBuffer toTemporaryDirectByteBuffer()
default int fastHash(long offset,
int length)
default long start()
default long capacity()
default long readPosition()
default long writePosition()
default long readRemaining()
default long writeRemaining()
default long readLimit()
default long writeLimit()
long address(long offset)
throws UnsupportedOperationException,
IllegalArgumentException
offset - within this buffer. address(start()) is the actual address of the first byte.UnsupportedOperationException - if the underlying buffer is on the heapIllegalArgumentException - if the offset is before the start() or the after the capacity()default ByteOrder byteOrder()
Bytes bytesForRead() throws IllegalStateException
IllegalStateExceptionBytes bytesForWrite() throws IllegalStateException
IllegalStateExceptionboolean compareAndSwapInt(long offset,
int expected,
int value)
throws BufferOverflowException,
IllegalArgumentException,
net.openhft.chronicle.core.io.IORuntimeException
offset - to perform CASexpected - valuevalue - to setBufferOverflowExceptionIllegalArgumentExceptionnet.openhft.chronicle.core.io.IORuntimeExceptionboolean compareAndSwapLong(long offset,
long expected,
long value)
throws BufferOverflowException,
IllegalArgumentException,
net.openhft.chronicle.core.io.IORuntimeException
offset - to perform CASexpected - valuevalue - to setBufferOverflowExceptionIllegalArgumentExceptionnet.openhft.chronicle.core.io.IORuntimeExceptiondefault boolean compareAndSwapFloat(long offset,
float expected,
float value)
throws BufferOverflowException,
IllegalArgumentException,
net.openhft.chronicle.core.io.IORuntimeException
offset - to perform CASexpected - valuevalue - to setBufferOverflowExceptionIllegalArgumentExceptionnet.openhft.chronicle.core.io.IORuntimeExceptiondefault boolean compareAndSwapDouble(long offset,
double expected,
double value)
throws BufferOverflowException,
IllegalArgumentException,
net.openhft.chronicle.core.io.IORuntimeException
offset - to perform CASexpected - valuevalue - to setBufferOverflowExceptionIllegalArgumentExceptionnet.openhft.chronicle.core.io.IORuntimeExceptionboolean isNative()
boolean sharedMemory()
Copyright © 2016. All rights reserved.