public interface RandomDataOutput<R extends RandomDataOutput<R>>
Modifier and Type | Method and Description |
---|---|
long |
address(long offset)
Obtain the underlying address.
|
default R |
append(long offset,
long value,
int digits) |
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.
|
void |
nativeWrite(long address,
long position,
long size)
expert level method to copy data from native memory into the BytesStore
|
default long |
readLimit() |
default long |
readPosition()
The read position must be start() <= readPosition() && readPosition() <= readLimit() && readPosition < safeLimit()
|
default long |
readRemaining() |
default long |
start() |
default R |
write(long offsetInRDO,
byte[] bytes) |
R |
write(long offsetInRDO,
byte[] bytes,
int offset,
int length) |
void |
write(long offsetInRDO,
ByteBuffer bytes,
int offset,
int length) |
default R |
write(long offsetInRDO,
Bytes bytes) |
R |
write(long offsetInRDO,
RandomDataInput bytes,
long offset,
long length) |
default R |
writeBoolean(long offset,
boolean flag)
Write a boolean at an offset.
|
R |
writeByte(long offset,
byte i8)
Write an unsigned byte at an offset.
|
default R |
writeByte(long offset,
int i)
Write a byte at an offset.
|
R |
writeDouble(long offset,
double d)
Write a double at an offset.
|
R |
writeFloat(long offset,
float d)
Write a float at an offset.
|
R |
writeInt(long offset,
int i)
Write an int at an offset.
|
default long |
writeLimit() |
R |
writeLong(long offset,
long i)
Write a long at an offset.
|
default R |
writeOrderedDouble(long offset,
double d)
Perform a non stalling write with a store barrier.
|
default R |
writeOrderedFloat(long offset,
float f)
Perform a non stalling write with a store barrier.
|
R |
writeOrderedInt(long offset,
int i)
Perform a non stalling write with a store barrier.
|
R |
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() |
R |
writeShort(long offset,
short i)
Write a short at an offset.
|
default R |
writeUnsignedByte(long offset,
int i)
Write an unsigned byte at an offset.
|
default R |
writeUnsignedInt(long offset,
long i)
Write an unsigned byte at an offset.
|
default R |
writeUnsignedShort(long offset,
int i)
Write an unsigned byte at an offset.
|
default long |
writeUtf8(long offset,
CharSequence cs)
Writes the given
cs to this RandomDataOutput from the given offset ,
in Utf8 format. |
default long |
writeUtf8Limited(long offset,
CharSequence cs,
int maxUtf8Len)
Writes the given
cs to this RandomDataOutput from the given offset ,
in Utf8 format, checking that the utf8 encoding size of the given char sequence is less or
equal to the given maxUtf8Len , otherwise IllegalArgumentException is thrown,
and no bytes of this RandomDataOutput are overwritten. |
R |
writeVolatileByte(long offset,
byte i8) |
default R |
writeVolatileDouble(long offset,
double d) |
default R |
writeVolatileFloat(long offset,
float f) |
R |
writeVolatileInt(long offset,
int i32) |
R |
writeVolatileLong(long offset,
long i64) |
R |
writeVolatileShort(long offset,
short i16) |
R |
zeroOut(long start,
long end)
Zero out the bytes between the start and the end.
|
default R writeByte(long offset, int i) throws BufferOverflowException, IllegalArgumentException, net.openhft.chronicle.core.io.IORuntimeException
offset
- to write toi
- the valueBufferOverflowException
- if the capacity was exceededIllegalArgumentException
- if the value cannot be cast to the type without loss.IORuntimeException
- if the underlying buffer fails to resize.net.openhft.chronicle.core.io.IORuntimeException
default R writeUnsignedByte(long offset, int i) throws BufferOverflowException, IllegalArgumentException, net.openhft.chronicle.core.io.IORuntimeException
offset
- to write toi
- the valueBufferOverflowException
- if the capacity was exceededIllegalArgumentException
- if the value cannot be cast to the type without loss.IORuntimeException
- if the underlying buffer fails to resize.net.openhft.chronicle.core.io.IORuntimeException
default R writeBoolean(long offset, boolean flag) throws BufferOverflowException, net.openhft.chronicle.core.io.IORuntimeException
offset
- to write toflag
- the valueBufferOverflowException
- if the capacity was exceededIORuntimeException
- if the underlying buffer fails to resize.net.openhft.chronicle.core.io.IORuntimeException
default R writeUnsignedShort(long offset, int i) throws BufferOverflowException, IllegalArgumentException, net.openhft.chronicle.core.io.IORuntimeException
offset
- to write toi
- the valueBufferOverflowException
- if the capacity was exceededIllegalArgumentException
- if the value cannot be cast to the type without loss.IORuntimeException
- if the underlying buffer fails to resize.net.openhft.chronicle.core.io.IORuntimeException
default R writeUnsignedInt(long offset, long i) throws BufferOverflowException, IllegalArgumentException, net.openhft.chronicle.core.io.IORuntimeException
offset
- to write toi
- the valueBufferOverflowException
- if the capacity was exceededIllegalArgumentException
- if the value cannot be cast to the type without loss.IORuntimeException
- if the underlying buffer fails to resize.net.openhft.chronicle.core.io.IORuntimeException
R writeByte(long offset, byte i8) throws BufferOverflowException, net.openhft.chronicle.core.io.IORuntimeException
offset
- to write toi8
- the valueBufferOverflowException
- if the capacity was exceededIORuntimeException
- if the underlying buffer fails to resize.net.openhft.chronicle.core.io.IORuntimeException
R writeShort(long offset, short i) throws BufferOverflowException, net.openhft.chronicle.core.io.IORuntimeException
offset
- to write toi
- the valueBufferOverflowException
- if the capacity was exceededIORuntimeException
- if the underlying buffer fails to resize.net.openhft.chronicle.core.io.IORuntimeException
R writeInt(long offset, int i) throws BufferOverflowException, net.openhft.chronicle.core.io.IORuntimeException
offset
- to write toi
- the valueBufferOverflowException
- if the capacity was exceededIORuntimeException
- if the underlying buffer fails to resize.net.openhft.chronicle.core.io.IORuntimeException
R writeOrderedInt(long offset, int i) throws BufferOverflowException, net.openhft.chronicle.core.io.IORuntimeException
offset
- to write toi
- value to writeBufferOverflowException
- if the capacity was exceededIORuntimeException
- if the underlying buffer fails to resize.net.openhft.chronicle.core.io.IORuntimeException
default R writeOrderedFloat(long offset, float f) throws BufferOverflowException, net.openhft.chronicle.core.io.IORuntimeException
offset
- to write tof
- value to writeBufferOverflowException
- if the capacity was exceededIORuntimeException
- if the underlying buffer fails to resize.net.openhft.chronicle.core.io.IORuntimeException
R writeLong(long offset, long i) throws BufferOverflowException, net.openhft.chronicle.core.io.IORuntimeException
offset
- to write toi
- the valueBufferOverflowException
- if the capacity was exceededIORuntimeException
- if the underlying buffer fails to resize.net.openhft.chronicle.core.io.IORuntimeException
R writeOrderedLong(long offset, long i) throws BufferOverflowException, net.openhft.chronicle.core.io.IORuntimeException
offset
- to write toi
- value to writeBufferOverflowException
net.openhft.chronicle.core.io.IORuntimeException
default R writeOrderedDouble(long offset, double d) throws BufferOverflowException, net.openhft.chronicle.core.io.IORuntimeException
offset
- to write tod
- value to writeBufferOverflowException
net.openhft.chronicle.core.io.IORuntimeException
R writeFloat(long offset, float d) throws BufferOverflowException, net.openhft.chronicle.core.io.IORuntimeException
offset
- to write tod
- the valueBufferOverflowException
- if the capacity was exceededIORuntimeException
- if the underlying buffer fails to resize.net.openhft.chronicle.core.io.IORuntimeException
R writeDouble(long offset, double d) throws BufferOverflowException, net.openhft.chronicle.core.io.IORuntimeException
offset
- to write tod
- the valueBufferOverflowException
- if the capacity was exceededIORuntimeException
- if the underlying buffer fails to resize.net.openhft.chronicle.core.io.IORuntimeException
R writeVolatileByte(long offset, byte i8) throws BufferOverflowException, net.openhft.chronicle.core.io.IORuntimeException
BufferOverflowException
net.openhft.chronicle.core.io.IORuntimeException
R writeVolatileShort(long offset, short i16) throws BufferOverflowException, net.openhft.chronicle.core.io.IORuntimeException
BufferOverflowException
net.openhft.chronicle.core.io.IORuntimeException
R writeVolatileInt(long offset, int i32) throws BufferOverflowException, net.openhft.chronicle.core.io.IORuntimeException
BufferOverflowException
net.openhft.chronicle.core.io.IORuntimeException
R writeVolatileLong(long offset, long i64) throws BufferOverflowException, net.openhft.chronicle.core.io.IORuntimeException
BufferOverflowException
net.openhft.chronicle.core.io.IORuntimeException
default R writeVolatileFloat(long offset, float f) throws BufferOverflowException, net.openhft.chronicle.core.io.IORuntimeException
BufferOverflowException
net.openhft.chronicle.core.io.IORuntimeException
default R writeVolatileDouble(long offset, double d) throws BufferOverflowException, net.openhft.chronicle.core.io.IORuntimeException
BufferOverflowException
net.openhft.chronicle.core.io.IORuntimeException
default R write(long offsetInRDO, @NotNull byte[] bytes) throws BufferOverflowException, net.openhft.chronicle.core.io.IORuntimeException
BufferOverflowException
net.openhft.chronicle.core.io.IORuntimeException
R write(long offsetInRDO, byte[] bytes, int offset, int length) throws BufferOverflowException, IllegalArgumentException, net.openhft.chronicle.core.io.IORuntimeException
BufferOverflowException
IllegalArgumentException
net.openhft.chronicle.core.io.IORuntimeException
void write(long offsetInRDO, ByteBuffer bytes, int offset, int length) throws BufferOverflowException, IllegalArgumentException, net.openhft.chronicle.core.io.IORuntimeException
BufferOverflowException
IllegalArgumentException
net.openhft.chronicle.core.io.IORuntimeException
default R write(long offsetInRDO, @NotNull Bytes bytes) throws BufferOverflowException, net.openhft.chronicle.core.io.IORuntimeException
BufferOverflowException
net.openhft.chronicle.core.io.IORuntimeException
R write(long offsetInRDO, RandomDataInput bytes, long offset, long length) throws BufferOverflowException, IllegalArgumentException, net.openhft.chronicle.core.io.IORuntimeException, BufferUnderflowException
BufferOverflowException
IllegalArgumentException
net.openhft.chronicle.core.io.IORuntimeException
BufferUnderflowException
R zeroOut(long start, long end) throws IllegalArgumentException, net.openhft.chronicle.core.io.IORuntimeException
start
- index of first byte inclusiveend
- index of last byte exclusiveBufferOverflowException
- if the capacity was exceededIORuntimeException
- if the underlying buffer fails to resize.IllegalArgumentException
net.openhft.chronicle.core.io.IORuntimeException
@NotNull default R append(long offset, long value, int digits) throws BufferOverflowException, IllegalArgumentException, net.openhft.chronicle.core.io.IORuntimeException
BufferOverflowException
IllegalArgumentException
net.openhft.chronicle.core.io.IORuntimeException
void nativeWrite(long address, long position, long size)
address
- in native memory to copy fromposition
- in BytesStore to copy tosize
- in bytesdefault long writeUtf8(long offset, @Nullable CharSequence cs) throws BufferOverflowException, net.openhft.chronicle.core.io.IORuntimeException
cs
to this RandomDataOutput
from the given offset
,
in Utf8 format. Returns the offset after the written char sequence.offset
- the offset to write char sequence fromcs
- the char sequence to write, could be null
RandomDataOutput
BufferOverflowException
net.openhft.chronicle.core.io.IORuntimeException
RandomDataInput.readUtf8(long, Appendable)
default long writeUtf8Limited(long offset, @Nullable CharSequence cs, int maxUtf8Len) throws BufferOverflowException, net.openhft.chronicle.core.io.IORuntimeException, IllegalArgumentException
cs
to this RandomDataOutput
from the given offset
,
in Utf8 format, checking that the utf8 encoding size of the given char sequence is less or
equal to the given maxUtf8Len
, otherwise IllegalArgumentException
is thrown,
and no bytes of this RandomDataOutput
are overwritten. Returns the offset after the
written char sequence.offset
- the offset to write char sequence fromcs
- the char sequence to write, could be null
maxUtf8Len
- the maximum allowed length (in Utf8 encoding) of the given char sequenceRandomDataOutput
IllegalArgumentException
- if the given char sequence size in Utf8 encoding exceeds
maxUtf8LenBufferOverflowException
net.openhft.chronicle.core.io.IORuntimeException
RandomDataInput.readUtf8Limited(long, Appendable, int)
,
RandomDataInput.readUtf8Limited(long, int)
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
IllegalStateException
Bytes bytesForWrite() throws IllegalStateException
IllegalStateException
boolean compareAndSwapInt(long offset, int expected, int value) throws BufferOverflowException, IllegalArgumentException, net.openhft.chronicle.core.io.IORuntimeException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
IllegalArgumentException
net.openhft.chronicle.core.io.IORuntimeException
boolean compareAndSwapLong(long offset, long expected, long value) throws BufferOverflowException, IllegalArgumentException, net.openhft.chronicle.core.io.IORuntimeException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
IllegalArgumentException
net.openhft.chronicle.core.io.IORuntimeException
default boolean compareAndSwapFloat(long offset, float expected, float value) throws BufferOverflowException, IllegalArgumentException, net.openhft.chronicle.core.io.IORuntimeException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
IllegalArgumentException
net.openhft.chronicle.core.io.IORuntimeException
default boolean compareAndSwapDouble(long offset, double expected, double value) throws BufferOverflowException, IllegalArgumentException, net.openhft.chronicle.core.io.IORuntimeException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
IllegalArgumentException
net.openhft.chronicle.core.io.IORuntimeException
Copyright © 2015. All rights reserved.