public interface RandomCommon
extends net.openhft.chronicle.core.io.ReferenceCounted
ReferenceCounted for lifecycle management and underpins RandomDataInput and RandomDataOutput.| Modifier and Type | Method and Description |
|---|---|
long |
addressForRead(long offset)
Retrieves the underlying memory address for reading.
|
default long |
addressForRead(long offset,
int buffer)
Retrieves the underlying memory address for reading.
|
long |
addressForWrite(long offset)
Retrieves the underlying memory address for writing.
|
long |
addressForWritePosition()
Retrieves the underlying memory address for writing at the current write position.
|
default ByteOrder |
byteOrder()
Retrieves the byte order used by the buffer.
|
@NotNull Bytes<?> |
bytesForRead() |
@NotNull Bytes<?> |
bytesForWrite()
Retrieves a Bytes object for writing.
|
default long |
capacity() |
boolean |
isDirectMemory()
Checks if the buffer uses direct memory.
|
default long |
lengthWritten(long startPosition)
Calculates the length of data written from the given start position.
|
default long |
readLimit()
If the resource is closed, the returned value is unspecified.
|
default long |
readPosition()
/**
|
default long |
readRemaining()
Calculates the number of bytes remaining that can be read from the current read position.
|
default long |
realCapacity() |
default long |
realReadRemaining()
Calculates the number of bytes that can be safely read directly.
|
default long |
realWriteRemaining()
Calculates the number of bytes remaining that can be written from the current write position with resizing.
|
boolean |
sharedMemory()
Checks if the Bytes use shared memory.
|
default long |
start() |
default long |
writeLimit()
Retrieves the maximum writable position within the buffer.
|
default long |
writePosition() |
default long |
writeRemaining()
Calculates the number of bytes remaining that can be written from the current write position.
|
default long start()
default long capacity()
Bytes.MAX_CAPACITY for virtual mappings.default long realCapacity()
capacity() and can grow on demand.default long readPosition()
start() <= readPosition() <= writePosition() and readPosition() <= readLimit().default long writePosition()
readPosition() <= writePosition() <= writeLimit().default long lengthWritten(long startPosition)
Typically this calculates the difference however for HexDumpBytes it's not as simple.
If the resource is closed, the returned value is unspecified.
startPosition - The position to calculate the length from.default long readRemaining()
If the resource is closed, the returned value is unspecified.
default long realReadRemaining()
If the resource is closed, the returned value is unspecified.
default long writeRemaining()
If the resource is closed, the returned value is unspecified.
default long realWriteRemaining()
If the resource is closed, the returned value is unspecified.
default long readLimit()
If the resource is closed, the returned value is unspecified.
default long writeLimit()
If the resource is closed, the returned value is unspecified.
long addressForRead(long offset)
throws UnsupportedOperationException,
BufferUnderflowException,
net.openhft.chronicle.core.io.ClosedIllegalStateException,
net.openhft.chronicle.core.io.ThreadingIllegalStateException
offset - within this buffer. addressForRead(start()) is the actual addressForRead of the first byte.UnsupportedOperationExceptionBufferUnderflowExceptionnet.openhft.chronicle.core.io.ClosedIllegalStateExceptionnet.openhft.chronicle.core.io.ThreadingIllegalStateExceptiondefault long addressForRead(long offset,
int buffer)
throws UnsupportedOperationException,
BufferUnderflowException,
net.openhft.chronicle.core.io.ClosedIllegalStateException,
net.openhft.chronicle.core.io.ThreadingIllegalStateException
offset - the logical offset within this buffer relative to start().buffer - the buffer index if this store is backed by multiple buffers.UnsupportedOperationException - if the buffer uses heap memory.BufferUnderflowException - if the offset is outside the allowed range.net.openhft.chronicle.core.io.ClosedIllegalStateException - if the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - if accessed concurrently in an unsafe way.long addressForWrite(long offset)
throws UnsupportedOperationException,
BufferOverflowException,
net.openhft.chronicle.core.io.ClosedIllegalStateException,
net.openhft.chronicle.core.io.ThreadingIllegalStateException
offset - within this buffer. addressForRead(start()) is the actual addressForRead of the first byte.UnsupportedOperationException - If the underlying buffer is on the heapBufferOverflowException - If the offset is before the start() or the after the capacity()net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe waylong addressForWritePosition()
throws UnsupportedOperationException,
BufferOverflowException,
net.openhft.chronicle.core.io.ClosedIllegalStateException
UnsupportedOperationException - If the underlying buffer is on the heap.BufferOverflowException - If the current write position is before the start or after the capacity.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe waydefault ByteOrder byteOrder()
@NotNull @NotNull Bytes<?> bytesForRead() throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
Bytes view for reading from this buffer.
The returned view reflects the current positions and limits.net.openhft.chronicle.core.io.ClosedIllegalStateExceptionnet.openhft.chronicle.core.io.ThreadingIllegalStateException@NotNull @NotNull Bytes<?> bytesForWrite() throws net.openhft.chronicle.core.io.ClosedIllegalStateException
net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayboolean sharedMemory()
boolean isDirectMemory()
Copyright © 2026 Chronicle Software Ltd. All rights reserved.