B
- The BytesStore typeU
- The underlying data type the BytesStore managespublic interface BytesStore<B extends BytesStore<B,U>,U> extends RandomDataInput, RandomDataOutput<B>, net.openhft.chronicle.core.io.ReferenceCounted, CharSequence
Modifier and Type | Method and Description |
---|---|
default double |
addAndGetDouble(long offset,
double adding)
Similar to
addAndGetInt(long, int) but operates on a double value. |
default double |
addAndGetDoubleNotAtomic(long offset,
double adding)
Perform a not atomic add and get operation for a float value.
|
default float |
addAndGetFloat(long offset,
float adding)
Similar to
addAndGetInt(long, int) but operates on a float value. |
default float |
addAndGetFloatNotAtomic(long offset,
float adding)
Perform a not atomic add and get operation for a float value.
|
default int |
addAndGetInt(long offset,
int adding)
Adds an integer to the current integer value at the specified offset and returns the result.
|
default int |
addAndGetIntNotAtomic(long offset,
int adding)
Perform a not atomic add and get operation for an int value.
|
default long |
addAndGetLong(long offset,
long adding)
Similar to
addAndGetInt(long, int) but operates on a long value. |
default short |
addAndGetShortNotAtomic(long offset,
short adding)
Perform a not atomic add and get operation for a short value.
|
default int |
addAndGetUnsignedByteNotAtomic(long offset,
int adding)
Perform a not atomic add and get operation for an unsigned byte value.
|
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 int |
byteCheckSum()
Returns the bytes sum of the readable bytes in this BytesStore.
|
default int |
byteCheckSum(long start,
long end)
Returns the bytes sum between the specified indexes; start (inclusive) and end (exclusive).
|
default ByteOrder |
byteOrder()
Retrieves the byte order used by the buffer.
|
default @NotNull Bytes<U> |
bytesForRead()
Returns a Bytes that wraps this ByteStore from the
start to the realCapacity . |
default @NotNull Bytes<U> |
bytesForWrite()
Returns a Bytes that wraps this ByteStore from the
start to the realCapacity . |
default @Nullable BytesStore |
bytesStore() |
long |
capacity()
Provides the maximum limit that can be set for the ByteStore.
|
default char |
charAt(int index)
Assume ISO-8859-1 encoding, subclasses can override this.
|
default void |
cipher(@NotNull Cipher cipher,
@NotNull Bytes<?> outBytes)
Convenience method to perform the cipher operation using thread local ByteBuffers for temporary buffers.
|
default void |
cipher(@NotNull Cipher cipher,
@NotNull Bytes<?> outBytes,
@NotNull ByteBuffer using1,
@NotNull ByteBuffer using2)
Encrypts or decrypts this BytesStore using the provided Cipher and writes the result to the outBytes.
|
default boolean |
compareAndSwapDouble(long offset,
double expected,
double value)
Similar to
compareAndSwapFloat(long, float, float) but operates on a double value. |
default boolean |
compareAndSwapFloat(long offset,
float expected,
float value)
Performs a compare-and-swap operation on the specified float value at the given offset.
|
default boolean |
contentEquals(@Nullable BytesStore bytesStore)
Returns if the content of this BytesStore is the same as the content of a specified BytesStore.
|
BytesStore<B,U> |
copy()
Creates and returns a copy of this BytesStore.
|
default long |
copyTo(@NotNull BytesStore store)
Returns the number of bytes that were copied from this BytesStore to a destination BytesStore.
|
default void |
copyTo(@NotNull OutputStream out)
Copies the bytes in the BytesStore to an OutputStream object.
|
static BytesStore<?,ByteBuffer> |
elasticByteBuffer(int size,
long maxSize)
Creates a flexible ByteBuffer instance that resides in native memory.
|
static BytesStore |
empty()
Provides an empty, fixed-sized and immutable BytesStore.
|
default boolean |
endsWith(char c)
Returns if the BytesStore ends with a specified character.
|
default boolean |
equalBytes(@NotNull BytesStore bytesStore,
long length)
Returns if a portion of a specified BytesStore matches this BytesStore.
|
static @NotNull BytesStore<?,ByteBuffer> |
follow(@NotNull ByteBuffer bb)
Wraps a ByteBuffer which can be either on heap or off heap without taking ownership of that buffer.
|
static <T> BytesStore<?,T> |
forFields(Object o,
String groupName,
int padding)
Provides a BytesStore that allows access to a group of fields in a given object.
|
static BytesStore |
from(@NotNull BytesStore cs)
Returns a BytesStore using the bytes in another specified BytesStore.
|
static BytesStore |
from(@NotNull CharSequence cs)
Converts a CharSequence into a BytesStore.
|
static BytesStore |
from(@NotNull String cs)
Converts a String into a BytesStore.
|
default long |
hash(long length)
Computes a hash code for this ByteStore's content up to the specified length.
|
default boolean |
inside(long offset)
Returns if a specified offset is inside this BytesStore limits.
|
default boolean |
inside(long offset,
long bufferSize)
Returns if a number of bytes starting from an offset are inside this ByteStore limits.
|
default boolean |
isClear()
Returns if the
readPosition is at the start and
the writeLimit is at the end . |
boolean |
isDirectMemory()
Checks if this BytesStore uses direct memory.
|
default boolean |
isEmpty() |
default boolean |
isEqual(long start,
long length,
String s)
Returns if a specified portion of this BytesStore is equal to a specified String.
|
static BytesStore<?,Void> |
lazyNativeBytesStoreWithFixedCapacity(long capacity)
Creates a lazily initialized BytesStore instance with a fixed capacity that resides in native memory.
|
default int |
length()
This method is inherited from CharSequence so result should be the length of the contained
chars sequence although it actually returns the number of underlying bytes.
|
default long |
lengthWritten(long startPosition)
Calculates the length of data written from the given start position.
|
void |
move(long from,
long to,
long length)
Moves a sequence of bytes within this BytesStore from the source to destination index.
|
static @NotNull PointerBytesStore |
nativePointer()
Creates a new PointerBytesStore that can be set to any address in memory.
|
static BytesStore<?,Void> |
nativeStore(long capacity)
This is an elastic native store.
|
static BytesStore<?,Void> |
nativeStoreFrom(byte[] bytes)
Creates and returns a new BytesStore that resides in native memory whereby the contents and
size of the native memory is determined by the provided
bytes array. |
static BytesStore<?,Void> |
nativeStoreWithFixedCapacity(long capacity)
Creates a BytesStore instance with a fixed capacity that resides in native memory.
|
default long |
readLimit()
If the resource is closed, the returned value is unspecified.
|
default long |
readPosition()
Returns the read position.
|
default long |
readRemaining()
Calculates the number of bytes remaining that can be read from the current read position.
|
default boolean |
readWrite()
Returns if this ByteStore can be both read from and written to.
|
default long |
realCapacity()
Returns the actual capacity of the ByteStore before any resizing occurs.
|
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.
|
default long |
safeLimit() |
boolean |
sharedMemory()
Checks if the Bytes use shared memory.
|
default long |
start() |
default boolean |
startsWith(@Nullable BytesStore bytesStore)
Returns if the content of this BytesStore starts with bytes equal to the content of a specified BytesStore.
|
default boolean |
startsWith(char c)
Returns if the BytesStore starts with a specified character.
|
default @NotNull CharSequence |
subSequence(int start,
int end)
This method constructs a new , memory storage type (heap or native) is preserved. |
default @NotNull String |
to8bitString()
Returns the content of this BytesStore in 8bitString format.
|
default @NotNull String |
toDebugString()
By default the maximum length of data shown is 256 characters.
|
default @NotNull String |
toDebugString(long maxLength)
This is assumed to be used to print the contents on a best effort basis.
|
U |
underlyingObject() |
static BytesStore<?,byte[]> |
wrap(byte[] bytes)
Wraps a byte array into a BytesStore.
|
static @NotNull BytesStore<?,ByteBuffer> |
wrap(@NotNull ByteBuffer bb)
Wraps a ByteBuffer into a BytesStore.
|
static @NotNull PointerBytesStore |
wrap(long address,
long length)
Creates a PointerBytesStore that wraps bytes starting from a specific address in memory.
|
default long |
writeLimit()
Retrieves the maximum writable position within the buffer.
|
default void |
writeMaxInt(long offset,
int atLeast)
Writes an int value at a specified offset if the value is not smaller than the current value at that offset.
|
default void |
writeMaxLong(long offset,
long atLeast)
Writes a long value at a specified offset if the value is not smaller than the current value at that offset.
|
default long |
writePosition()
Returns the write position.
|
default long |
writeRemaining()
Calculates the number of bytes remaining that can be written from the current write position.
|
default B |
zeroOut(long start,
long end)
Fills the BytesStore with zeros.
|
canReadDirect, canReadDirect, compareUtf8, copyTo, copyTo, fastHash, findByte, nativeRead, parseLong, peekUnsignedByte, peekVolatileInt, printable, read, readBoolean, readByte, readDouble, readFloat, readIncompleteLong, readInt, readLong, readShort, readUnsignedByte, readUnsignedInt, readUnsignedInt24, readUnsignedShort, readUtf8, readUtf8Limited, readUtf8Limited, readVolatileByte, readVolatileDouble, readVolatileFloat, readVolatileInt, readVolatileLong, readVolatileShort, subBytes, toByteArray, toTemporaryDirectByteBuffer
append, append, appendAndReturnLength, compareAndSwapInt, compareAndSwapLong, nativeWrite, testAndSetInt, write, write, write, write, write, write8bit, write8bit, writeBoolean, writeByte, writeByte, writeDouble, writeFloat, writeInt, writeInt24, writeLong, writeOrderedDouble, writeOrderedFloat, writeOrderedInt, writeOrderedLong, writeShort, writeUnsignedByte, writeUnsignedInt, writeUnsignedShort, writeUtf8, writeUtf8Limited, writeVolatileByte, writeVolatileDouble, writeVolatileFloat, writeVolatileInt, writeVolatileLong, writeVolatileShort
addReferenceChangeListener, refCount, release, releaseLast, releaseLast, removeReferenceChangeListener, reserve, reserveTransfer, tryReserve
referenceId, referenceName, temporary
chars, codePoints, toString
static BytesStore from(@NotNull @NotNull CharSequence cs) throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
cs
- the CharSequence to be convertednet.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 way.static BytesStore from(@NotNull @NotNull BytesStore cs) throws net.openhft.chronicle.core.io.ClosedIllegalStateException
cs
- the source BytesStorenet.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 way.static BytesStore from(@NotNull @NotNull String cs)
cs
- the String to be convertedstatic <T> BytesStore<?,T> forFields(Object o, String groupName, int padding)
o
- the object that contains the fieldsgroupName
- the group name of the fieldspadding
- the padding to be usedstatic BytesStore<?,byte[]> wrap(byte[] bytes)
bytes
- the byte array to be wrapped@NotNull static @NotNull BytesStore<?,ByteBuffer> wrap(@NotNull @NotNull ByteBuffer bb)
bb
- the ByteBuffer to be wrappedfollow(ByteBuffer)
@NotNull static @NotNull BytesStore<?,ByteBuffer> follow(@NotNull @NotNull ByteBuffer bb)
When resulting BytesStore instance is closed, direct byteBuffer
will not be deallocated so its
life cycle should be tracked elsewhere.
bb
- the ByteBuffer to followwrap(ByteBuffer)
static BytesStore<?,Void> nativeStore(long capacity)
capacity
- the initial capacity of the bufferstatic BytesStore<?,Void> nativeStoreWithFixedCapacity(long capacity)
capacity
- the fixed capacity of the bufferstatic BytesStore<?,Void> lazyNativeBytesStoreWithFixedCapacity(long capacity)
capacity
- the fixed capacity of the bufferstatic BytesStore<?,ByteBuffer> elasticByteBuffer(int size, long maxSize)
size
- the initial size of the ByteBuffermaxSize
- the maximum allowable size of the ByteBufferstatic BytesStore<?,Void> nativeStoreFrom(byte[] bytes)
bytes
array.bytes
- the content to initialize the new ByteStorebytes
array@NotNull static @NotNull PointerBytesStore nativePointer()
@NotNull static @NotNull PointerBytesStore wrap(long address, long length)
address
- the starting memory address for the PointerBytesStorelength
- the length of the memory segment to be wrapped by the PointerBytesStorestatic BytesStore empty()
default boolean compareAndSwapFloat(long offset, float expected, float value) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
compareAndSwapFloat
in interface RandomDataOutput<B extends BytesStore<B,U>>
offset
- the position where the float value is storedexpected
- the expected current valuevalue
- the new value to be set if the current value equals the expected valueBufferOverflowException
- If the offset is out of boundsnet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.default boolean compareAndSwapDouble(long offset, double expected, double value) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
compareAndSwapFloat(long, float, float)
but operates on a double value.compareAndSwapDouble
in interface RandomDataOutput<B extends BytesStore<B,U>>
offset
- the offset at which to perform the CAS operation.expected
- the expected current value.value
- the new value to set if the current value matches the expected value.BufferOverflowException
- If the offset plus the size of a double exceeds the buffer's capacity.net.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.default int addAndGetInt(long offset, int adding) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
addAndGetInt
in interface RandomDataInput
addAndGetInt
in interface RandomDataOutput<B extends BytesStore<B,U>>
offset
- the position where the integer is storedadding
- the integer to addBufferUnderflowException
- If the offset is out of boundsnet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.default long addAndGetLong(long offset, long adding) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
addAndGetInt(long, int)
but operates on a long value.addAndGetLong
in interface RandomDataInput
addAndGetLong
in interface RandomDataOutput<B extends BytesStore<B,U>>
offset
- to add and getadding
- value to add, can be 1BufferUnderflowException
- If the offset is outside the limits of the Bytesnet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.default float addAndGetFloat(long offset, float adding) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
addAndGetInt(long, int)
but operates on a float value.addAndGetFloat
in interface RandomDataInput
addAndGetFloat
in interface RandomDataOutput<B extends BytesStore<B,U>>
offset
- to add and getadding
- value to add, can be 1BufferUnderflowException
- If the offset is outside the limits of the Bytesnet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.default double addAndGetDouble(long offset, double adding) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
addAndGetInt(long, int)
but operates on a double value.addAndGetDouble
in interface RandomDataInput
addAndGetDouble
in interface RandomDataOutput<B extends BytesStore<B,U>>
offset
- to add and getadding
- value to add, can be 1BufferUnderflowException
- If the offset is outside the limits of the Bytesnet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.boolean isDirectMemory()
BytesStore<B,U> copy() throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
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 way.@NotNull default @NotNull Bytes<U> bytesForRead() throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
start
to the realCapacity
.
The returned Bytes is not elastic and can be both read and written using cursors.
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 way.@NotNull default @NotNull Bytes<U> bytesForWrite() throws net.openhft.chronicle.core.io.ClosedIllegalStateException
start
to the realCapacity
.
The returned Bytes is not elastic and can be both read and written using cursors.
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 way.default boolean isClear()
readPosition
is at the start
and
the writeLimit
is at the end
.
I.e start() == readPosition() && writeLimit() == capacity()
readPosition
is at the start
and
the writeLimit
is at the end
default long realCapacity()
realCapacity
in interface RandomDataInput
long capacity()
@Nullable U underlyingObject()
default boolean inside(long offset)
Use this test to determine if an offset is considered safe for reading from. Note that it checks we are inside the BytesStore limits *without* including the overlap
offset
- the specified offset to checktrue
if offset is safedefault boolean inside(long offset, long bufferSize)
offset
- the starting index to checkbufferSize
- the number of bytes to be read/writtentrue
if the bytes between the offset and offset+buffer are inside the BytesStoredefault long safeLimit()
default long copyTo(@NotNull @NotNull BytesStore store) throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
Copies the data to another BytesStore as long as space is available in the destination BytesStore.
store
- the BytesStore to copy tonet.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 way.default void copyTo(@NotNull @NotNull OutputStream out) throws IOException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
out
- the specified OutputStream that this BytesStore is copied tonet.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 way.IOException
OutputStream
@NotNull default B zeroOut(long start, long end) throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
zeroOut
in interface RandomDataOutput<B extends BytesStore<B,U>>
start
- first byte inclusiveend
- last byte exclusivenet.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 way.default int length()
length
in interface CharSequence
default char charAt(int index) throws IndexOutOfBoundsException
charAt
in interface CharSequence
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 way.IndexOutOfBoundsException
@NotNull default @NotNull CharSequence subSequence(int start, int end)
subSequence
in interface CharSequence
@NotNull default @NotNull String toDebugString()
toDebugString(long)
if you want more.
This is assumed to be used to print the contents on a best effort basis. If an Error occurs it will be returned in the String.
@NotNull default @NotNull String toDebugString(long maxLength)
This is assumed to be used to print the contents on a best effort basis. If an Error occurs it will be returned in the String.
maxLength
- the maximum length of the output@Nullable default @Nullable BytesStore bytesStore()
default boolean equalBytes(@NotNull @NotNull BytesStore bytesStore, long length) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
bytesStore
- the BytesStore to match againstlength
- the length to matchtrue
if the bytes up to min(length, this.length(), bytesStore.length()) matched.BufferUnderflowException
- If there's not enough data to be movednet.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 int byteCheckSum() throws net.openhft.chronicle.core.io.IORuntimeException, BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
BufferUnderflowException
- If there's not enough data to be movednet.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 waynet.openhft.chronicle.core.io.IORuntimeException
default int byteCheckSum(long start, long end) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
start
- the index of the first byte to sumend
- the index of the last byte to sumBufferUnderflowException
- If the specified indexes are outside the limits of the BytesStorenet.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 way.default boolean endsWith(char c) throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
c
- the character to look fortrue
if the specified character is the same as the last character of this BytesStorenet.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 way.default boolean startsWith(char c) throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
c
- the character to look fortrue
if the specified character is the same as the first character of this BytesStorenet.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 way.default boolean contentEquals(@Nullable @Nullable BytesStore bytesStore) throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
bytesStore
- the BytesStore to compare withtrue
if this BytesStore and the input BytesStore contain the same datanet.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 way.default boolean startsWith(@Nullable @Nullable BytesStore bytesStore) throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
bytesStore
- the BytesStore to compare withtrue
if the content of this BytesStore starts with bytesStorenet.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 way.@NotNull default @NotNull String to8bitString() throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
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 way.default int addAndGetUnsignedByteNotAtomic(long offset, int adding) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
offset
- to add and getadding
- value to add, can be 1BufferUnderflowException
- If there's not enough data to be movednet.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 way.default short addAndGetShortNotAtomic(long offset, short adding) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
offset
- to add and getadding
- value to add, can be 1BufferUnderflowException
- If there's not enough data to be movednet.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 way.default int addAndGetIntNotAtomic(long offset, int adding) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
offset
- to add and getadding
- value to add, can be 1BufferUnderflowException
- If there's not enough data to be movednet.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 way.default double addAndGetDoubleNotAtomic(long offset, double adding) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
offset
- to add and getadding
- value to add, can be 1BufferUnderflowException
- If there's not enough data to be movednet.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 way.default float addAndGetFloatNotAtomic(long offset, float adding) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
offset
- to add and getadding
- value to add, can be 1BufferUnderflowException
- If there's not enough data to be movednet.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 way.void move(long from, long to, long length) throws BufferUnderflowException, ArithmeticException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
from
- the index of the first byte to be movedto
- the index where the first byte should be moved tolength
- the number of bytes to be movedBufferUnderflowException
- If there's not enough data to be movedArithmeticException
- If the move would result in an index overflownet.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 way.default void writeMaxLong(long offset, long atLeast) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
offset
- the offset to write toatLeast
- the long value that is to be written at offset if it is not less than the current value at offsetBufferUnderflowException
- If there's not enough data to be movednet.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 void writeMaxInt(long offset, int atLeast) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
offset
- the offset to write toatLeast
- the int value that is to be written at offset if it is not less than the current value at offsetBufferUnderflowException
- If there's not enough data to be movednet.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 boolean isEmpty()
true
if the number of readable bytes of this BytesStore is zero.default void cipher(@NotNull @NotNull Cipher cipher, @NotNull @NotNull Bytes<?> outBytes, @NotNull @NotNull ByteBuffer using1, @NotNull @NotNull ByteBuffer using2) throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
cipher
- the Cipher to use for encryption or decryptionoutBytes
- the Bytes object where the result will be writtenusing1
- a ByteBuffer to use as temporary buffer during the operationusing2
- another ByteBuffer to use as temporary buffer during the operationnet.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 void cipher(@NotNull @NotNull Cipher cipher, @NotNull @NotNull Bytes<?> outBytes) throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
cipher
- the Cipher to use for encryption or decryptionoutBytes
- the Bytes object where the result will be writtennet.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 boolean readWrite()
This is in contrast to a ByteStore than can only be read.
default long hash(long length)
length
- the length up to which the hash code is to be computednet.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 way.default boolean isEqual(long start, long length, String s) throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
start
- the portion offsetlength
- the number of bytes from this BytesStore that should be compared to ss
- the String to compare totrue
if the specified portion of this BytesStore is equal to snet.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 way.default long start()
default long readPosition()
The read position is start() <= readPosition() && readPosition() <= readLimit() && readPosition < safeLimit()
If the resource is closed, the returned value is unspecified.
default long writePosition()
The write position is readPosition() <= writePosition() && writePosition() <= writeLimit()
If the resource is closed, the returned value is unspecified.
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.UnsupportedOperationException
- If the underlying buffer is on the heapBufferUnderflowException
- 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 waydefault long addressForRead(long offset, int buffer) throws UnsupportedOperationException, BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
offset
- The offset within this buffer.buffer
- The buffer index.UnsupportedOperationException
- If the underlying buffer is on the heap.BufferUnderflowException
- If the offset 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 waylong 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()
boolean sharedMemory()
Copyright © 2023. All rights reserved.