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 byte |
addAndGetByteNotAtomic(long offset,
byte adding)
Deprecated.
|
default double |
addAndGetDoubleNotAtomic(long offset,
double adding)
Deprecated.
|
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 long |
addAndGetLongNotAtomic(long offset,
long adding)
Deprecated.
|
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.
|
default long |
addAndGetUnsignedIntNotAtomic(long offset,
int adding)
Deprecated.
|
default int |
addAndGetUnsignedShortNotAtomic(long offset,
int adding)
Deprecated.
|
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 CharSequence cs)
This method builds a BytesStore using the bytes in a CharSequence.
|
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 boolean |
isPresent()
Deprecated.
|
default void |
isPresent(boolean isPresent)
Deprecated.
|
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 |
longCheckSum()
Deprecated.
|
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)
cs
- to convertstatic 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()
@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)
store
- to copy todefault void copyTo(@NotNull @NotNull OutputStream out) throws IOException
IOException
@NotNull default B zeroOut(long start, long end)
zeroOut
in interface RandomDataOutput<B extends BytesStore<B,Underlying>>
start
- first byte inclusiveend
- last byte exclusive.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()
@NotNull default @NotNull String toDebugString(long maxLength)
maxLength
- the maximum len of the output@Nullable default @Nullable BytesStore bytesStore()
default boolean equalBytes(@NotNull @NotNull BytesStore bytesStore, long length) throws BufferUnderflowException
bytesStore
- to match againstlength
- to match.BufferUnderflowException
default int byteCheckSum() throws net.openhft.chronicle.core.io.IORuntimeException
net.openhft.chronicle.core.io.IORuntimeException
default int byteCheckSum(long start, long end)
@Deprecated default long longCheckSum()
default boolean endsWith(char c)
c
- to look fordefault boolean startsWith(char c)
c
- to look fordefault boolean contentEquals(@Nullable @Nullable BytesStore bytesStore)
bytesStore
- to compare withdefault boolean startsWith(@Nullable @Nullable BytesStore bytesStore)
@NotNull default @NotNull String to8bitString() throws IllegalArgumentException
IllegalArgumentException
@Deprecated default byte addAndGetByteNotAtomic(long offset, byte adding) throws BufferUnderflowException
offset
- to add and getadding
- value to add, can be 1BufferUnderflowException
default int addAndGetUnsignedByteNotAtomic(long offset, int adding) throws BufferUnderflowException
offset
- to add and getadding
- value to add, can be 1BufferUnderflowException
default short addAndGetShortNotAtomic(long offset, short adding) throws BufferUnderflowException
offset
- to add and getadding
- value to add, can be 1BufferUnderflowException
@Deprecated default int addAndGetUnsignedShortNotAtomic(long offset, int adding) throws BufferUnderflowException
offset
- to add and getadding
- value to add, can be 1BufferUnderflowException
default int addAndGetIntNotAtomic(long offset, int adding) throws BufferUnderflowException
offset
- to add and getadding
- value to add, can be 1BufferUnderflowException
@Deprecated default long addAndGetUnsignedIntNotAtomic(long offset, int adding) throws BufferUnderflowException
offset
- to add and getadding
- value to add, can be 1BufferUnderflowException
@Deprecated default long addAndGetLongNotAtomic(long offset, long adding) throws BufferUnderflowException
offset
- to add and getadding
- value to add, can be 1BufferUnderflowException
default float addAndGetFloatNotAtomic(long offset, float adding) throws BufferUnderflowException
offset
- to add and getadding
- value to add, can be 1BufferUnderflowException
@Deprecated default double addAndGetDoubleNotAtomic(long offset, double adding) throws BufferUnderflowException
offset
- to add and getadding
- value to add, can be 1BufferUnderflowException
@Deprecated default void isPresent(boolean isPresent) throws IllegalArgumentException
isPresent
- if there is data, or false if not.IllegalArgumentException
@Deprecated default boolean isPresent()
void move(long from, long to, long length) throws BufferUnderflowException
BufferUnderflowException
default void writeMaxLong(long offset, long atLeast) throws BufferUnderflowException
offset
- to write toatLeast
- value it is at least.BufferUnderflowException
default void writeMaxInt(long offset, int atLeast) throws BufferUnderflowException
offset
- to write toatLeast
- value it is at least.BufferUnderflowException
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
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()default long addressForRead(long offset, int buffer) throws UnsupportedOperationException, BufferUnderflowException
long addressForWrite(long offset) throws UnsupportedOperationException, BufferOverflowException
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()long addressForWritePosition() throws UnsupportedOperationException, BufferOverflowException
default ByteOrder byteOrder()
boolean compareAndSwapInt(long offset, int expected, int value) throws BufferOverflowException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
void testAndSetInt(long offset, int expected, int value)
boolean compareAndSwapLong(long offset, long expected, long value) throws BufferOverflowException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
default boolean compareAndSwapFloat(long offset, float expected, float value) throws BufferOverflowException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
default boolean compareAndSwapDouble(long offset, double expected, double value) throws BufferOverflowException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
boolean sharedMemory()
Copyright © 2020. All rights reserved.