public interface BytesStore<B extends BytesStore<B,Underlying>,Underlying> extends RandomDataInput, RandomDataOutput<B>, net.openhft.chronicle.core.io.ReferenceCounted, CharSequence
charToString
Modifier and Type | Method and Description |
---|---|
default double |
addAndGetDoubleNotAtomic(long offset,
double adding)
Perform a not atomic add and get operation for a float value.
|
default float |
addAndGetFloatNotAtomic(long offset,
float adding)
Perform a not atomic add and get operation for a float value.
|
default int |
addAndGetIntNotAtomic(long offset,
int adding)
Perform a not atomic add and get operation for an int 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)
Obtain the underlying addressForRead.
|
default long |
addressForRead(long offset,
int buffer) |
long |
addressForWrite(long offset)
Obtain the underlying addressForRead.
|
long |
addressForWritePosition() |
default int |
byteCheckSum()
Return the bytes sum of the readable bytes.
|
default int |
byteCheckSum(long start,
long end) |
default ByteOrder |
byteOrder() |
default @NotNull Bytes<Underlying> |
bytesForRead() |
default @NotNull Bytes<Underlying> |
bytesForWrite() |
default @Nullable BytesStore |
bytesStore() |
long |
capacity() |
default char |
charAt(int index)
Assume ISO-8859-1 encoding, subclasses can override this.
|
default void |
cipher(@NotNull Cipher cipher,
@NotNull Bytes outBytes) |
default void |
cipher(@NotNull Cipher cipher,
@NotNull Bytes outBytes,
@NotNull ByteBuffer using1,
@NotNull ByteBuffer using2) |
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 |
contentEquals(@Nullable BytesStore bytesStore)
Compare the contents of the BytesStores.
|
BytesStore<B,Underlying> |
copy() |
default long |
copyTo(@NotNull BytesStore store)
Copy the data to another BytesStore as long as there is space available in the destination store.
|
default void |
copyTo(@NotNull OutputStream out) |
static BytesStore |
empty() |
default boolean |
endsWith(char c)
Does the BytesStore end with a character?
|
default boolean |
equalBytes(@NotNull BytesStore bytesStore,
long length)
Check if a portion of a BytesStore matches this one.
|
static BytesStore |
from(@NotNull BytesStore cs) |
static BytesStore |
from(@NotNull CharSequence cs)
This method builds a BytesStore using the bytes in a CharSequence.
|
static BytesStore |
from(@NotNull String cs) |
default boolean |
inside(long offset)
Use this test to determine if an offset is considered safe.
|
default boolean |
inside(long offset,
long buffer) |
default boolean |
isClear()
Returns if the
readPosition is at the start and
the writeLimit is at the end . |
boolean |
isDirectMemory() |
default boolean |
isEmpty() |
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.
|
void |
move(long from,
long to,
long length) |
static @NotNull PointerBytesStore |
nativePointer() |
default long |
readLimit() |
default long |
readPosition()
The read position must be start() <= readPosition() && readPosition() <= readLimit() && readPosition < safeLimit()
|
default long |
readRemaining() |
default boolean |
readWrite() |
default long |
realCapacity()
Returns the actual capacity that can be potentially read.
|
default long |
safeLimit() |
boolean |
sharedMemory() |
default long |
start() |
default boolean |
startsWith(@Nullable BytesStore bytesStore) |
default boolean |
startsWith(char c)
Does the BytesStore start with a character?
|
default @NotNull CharSequence |
subSequence(int start,
int end)
Not supported.
|
void |
testAndSetInt(long offset,
int expected,
int value) |
default @NotNull String |
to8bitString() |
default @NotNull String |
toDebugString()
By default the maximum length of data shown is 256 characters.
|
default @NotNull String |
toDebugString(long maxLength) |
Underlying |
underlyingObject() |
static HeapBytesStore<byte[]> |
wrap(@NotNull byte[] bytes)
Wraps a byte[].
|
static @NotNull BytesStore<?,ByteBuffer> |
wrap(@NotNull ByteBuffer bb)
Wraps a ByteBuffer which can be either on heap or off heap.
|
static @NotNull PointerBytesStore |
wrap(long address,
long length)
Return the addressForRead and length as a BytesStore
|
default long |
writeLimit() |
default void |
writeMaxInt(long offset,
int atLeast)
Write a value which is not smaller.
|
default void |
writeMaxLong(long offset,
long atLeast)
Write a value which is not smaller.
|
default long |
writePosition()
The read position must be readPosition() <= writePosition() && writePosition() <= writeLimit()
|
default long |
writeRemaining() |
default B |
zeroOut(long start,
long end)
Fill the BytesStore with zeros
|
addAndGetDouble, addAndGetFloat, addAndGetInt, addAndGetLong, canReadDirect, compareUtf8, copyTo, copyTo, createCharToString, 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, nativeWrite, write, write, write, write, write, writeBoolean, writeByte, writeByte, writeDouble, writeFloat, writeInt, writeInt24, writeLong, writeOrderedDouble, writeOrderedFloat, writeOrderedInt, writeOrderedLong, writeShort, writeUnsignedByte, writeUnsignedInt, writeUnsignedShort, writeUtf8, writeUtf8Limited, writeVolatileByte, writeVolatileDouble, writeVolatileFloat, writeVolatileInt, writeVolatileLong, writeVolatileShort
refCount, release, releaseLast, releaseLast, reserve, reservedBy, reserveTransfer, tryReserve
referenceId, referenceName, temporary
chars, codePoints, toString
static BytesStore from(@NotNull @NotNull CharSequence cs) throws IllegalStateException
cs
- to convertIllegalStateException
static BytesStore from(@NotNull @NotNull BytesStore cs) throws IllegalStateException
IllegalStateException
static BytesStore from(@NotNull @NotNull String cs)
static HeapBytesStore<byte[]> wrap(@NotNull @NotNull byte[] bytes)
bytes
- to wrap@NotNull static @NotNull BytesStore<?,ByteBuffer> wrap(@NotNull @NotNull ByteBuffer bb)
bb
- to wrap@NotNull static @NotNull PointerBytesStore nativePointer()
@NotNull static @NotNull PointerBytesStore wrap(long address, long length)
address
- for the startlength
- of datastatic BytesStore empty()
boolean isDirectMemory()
BytesStore<B,Underlying> copy() throws IllegalStateException
IllegalStateException
@NotNull default @NotNull Bytes<Underlying> bytesForRead() throws IllegalStateException
IllegalStateException
- if this Bytes has been released.@NotNull default @NotNull Bytes<Underlying> bytesForWrite() throws IllegalStateException
IllegalStateException
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()
RandomDataInput
realCapacity
in interface RandomDataInput
long capacity()
@Nullable Underlying underlyingObject()
default boolean inside(long offset)
default boolean inside(long offset, long buffer)
default long safeLimit()
default long copyTo(@NotNull @NotNull BytesStore store) throws IllegalStateException
store
- to copy toIllegalStateException
default void copyTo(@NotNull @NotNull OutputStream out) throws IOException, IllegalStateException
IOException
IllegalStateException
@NotNull default B zeroOut(long start, long end) throws IllegalStateException
zeroOut
in interface RandomDataOutput<B extends BytesStore<B,Underlying>>
start
- first byte inclusiveend
- last byte exclusive.IllegalStateException
default int length()
length
in interface CharSequence
default char charAt(int index) throws IndexOutOfBoundsException
charAt
in interface CharSequence
IndexOutOfBoundsException
@NotNull default @NotNull CharSequence subSequence(int start, int end)
subSequence
in interface CharSequence
@NotNull default @NotNull String toDebugString() throws IllegalStateException
IllegalStateException
@NotNull default @NotNull String toDebugString(long maxLength) throws IllegalStateException, ArithmeticException
maxLength
- the maximum len of the outputIllegalStateException
ArithmeticException
@Nullable default @Nullable BytesStore bytesStore()
default boolean equalBytes(@NotNull @NotNull BytesStore bytesStore, long length) throws BufferUnderflowException, IllegalStateException
bytesStore
- to match againstlength
- to match.BufferUnderflowException
IllegalStateException
default int byteCheckSum() throws net.openhft.chronicle.core.io.IORuntimeException, BufferUnderflowException, IllegalStateException
net.openhft.chronicle.core.io.IORuntimeException
BufferUnderflowException
IllegalStateException
default int byteCheckSum(long start, long end) throws BufferUnderflowException, IllegalStateException
default boolean endsWith(char c) throws IllegalStateException
c
- to look forIllegalStateException
default boolean startsWith(char c) throws IllegalStateException
c
- to look forIllegalStateException
default boolean contentEquals(@Nullable @Nullable BytesStore bytesStore) throws IllegalStateException
bytesStore
- to compare withIllegalStateException
default boolean startsWith(@Nullable @Nullable BytesStore bytesStore) throws IllegalStateException
IllegalStateException
@NotNull default @NotNull String to8bitString()
default int addAndGetUnsignedByteNotAtomic(long offset, int adding) throws BufferUnderflowException, IllegalStateException
offset
- to add and getadding
- value to add, can be 1BufferUnderflowException
IllegalStateException
default short addAndGetShortNotAtomic(long offset, short adding) throws BufferUnderflowException, IllegalStateException
offset
- to add and getadding
- value to add, can be 1BufferUnderflowException
IllegalStateException
default int addAndGetIntNotAtomic(long offset, int adding) throws BufferUnderflowException, IllegalStateException
offset
- to add and getadding
- value to add, can be 1BufferUnderflowException
IllegalStateException
default double addAndGetDoubleNotAtomic(long offset, double adding) throws BufferUnderflowException, IllegalStateException
offset
- to add and getadding
- value to add, can be 1BufferUnderflowException
IllegalStateException
default float addAndGetFloatNotAtomic(long offset, float adding) throws BufferUnderflowException, IllegalStateException
offset
- to add and getadding
- value to add, can be 1BufferUnderflowException
IllegalStateException
void move(long from, long to, long length) throws BufferUnderflowException, IllegalStateException, ArithmeticException
default void writeMaxLong(long offset, long atLeast) throws BufferUnderflowException, IllegalStateException
offset
- to write toatLeast
- value it is at least.BufferUnderflowException
IllegalStateException
default void writeMaxInt(long offset, int atLeast) throws BufferUnderflowException, IllegalStateException
offset
- to write toatLeast
- value it is at least.BufferUnderflowException
IllegalStateException
default boolean isEmpty()
default void cipher(@NotNull @NotNull Cipher cipher, @NotNull @NotNull Bytes outBytes, @NotNull @NotNull ByteBuffer using1, @NotNull @NotNull ByteBuffer using2) throws IllegalStateException
IllegalStateException
default void cipher(@NotNull @NotNull Cipher cipher, @NotNull @NotNull Bytes outBytes) throws IllegalStateException
IllegalStateException
default boolean readWrite()
default long start()
default long readPosition()
default long writePosition()
default long readRemaining()
default long writeRemaining()
default long readLimit()
default long writeLimit()
long addressForRead(long offset) throws UnsupportedOperationException, BufferUnderflowException, IllegalStateException
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()IllegalStateException
default long addressForRead(long offset, int buffer) throws UnsupportedOperationException, BufferUnderflowException, IllegalStateException
long addressForWrite(long offset) throws UnsupportedOperationException, BufferOverflowException, IllegalStateException
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()IllegalStateException
long addressForWritePosition() throws UnsupportedOperationException, BufferOverflowException, IllegalStateException
default ByteOrder byteOrder()
boolean compareAndSwapInt(long offset, int expected, int value) throws BufferOverflowException, IllegalStateException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
IllegalStateException
void testAndSetInt(long offset, int expected, int value) throws BufferOverflowException, IllegalStateException
boolean compareAndSwapLong(long offset, long expected, long value) throws BufferOverflowException, IllegalStateException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
IllegalStateException
default boolean compareAndSwapFloat(long offset, float expected, float value) throws BufferOverflowException, IllegalStateException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
IllegalStateException
default boolean compareAndSwapDouble(long offset, double expected, double value) throws BufferOverflowException, IllegalStateException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
IllegalStateException
boolean sharedMemory()
Copyright © 2021. All rights reserved.