public interface BytesStore<B extends BytesStore<B,Underlying>,Underlying> extends RandomDataInput, RandomDataOutput<B>, net.openhft.chronicle.core.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.
|
default int |
byteCheckSum()
Return the bytes sum of the readable bytes.
|
default int |
byteCheckSum(long start,
long end) |
default ByteOrder |
byteOrder() |
default Bytes<Underlying> |
bytesForRead() |
default Bytes<Underlying> |
bytesForWrite() |
default BytesStore |
bytesStore() |
long |
capacity() |
default char |
charAt(int index)
Assume ISO-8859-1 encoding, subclasses can override this.
|
default void |
cipher(Cipher cipher,
Bytes outBytes) |
default void |
cipher(Cipher cipher,
Bytes outBytes,
ByteBuffer using1,
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(BytesStore bytesStore)
Compare the contents of the BytesStores.
|
BytesStore<B,Underlying> |
copy() |
default long |
copyTo(BytesStore store)
Copy the data to another BytesStore as long as there is space available in the destination store.
|
default void |
copyTo(OutputStream out) |
static BytesStore |
empty() |
default boolean |
endsWith(char c)
Does the BytesStore end with a character?
|
default boolean |
equalBytes(BytesStore bytesStore,
long length)
Check if a portion of a BytesStore matches this one.
|
static BytesStore |
from(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,
int buffer) |
default boolean |
isClear()
The Bytes are clear if start() == readPosition() && writeLimit() == capacity()
|
boolean |
isDirectMemory() |
default boolean |
isEmpty() |
default boolean |
isPresent()
Deprecated.
|
default void |
isPresent(boolean isPresent)
Deprecated.
|
default int |
length() |
default long |
longCheckSum()
Deprecated.
|
void |
move(long from,
long to,
long length) |
static 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() |
default long |
safeLimit() |
boolean |
sharedMemory() |
default long |
start() |
default boolean |
startsWith(BytesStore bytesStore) |
default boolean |
startsWith(char c)
Does the BytesStore start with a character?
|
default CharSequence |
subSequence(int start,
int end)
Not supported.
|
default String |
to8bitString() |
default String |
toDebugString()
By default the maximum length of data shown is 256 characters.
|
default String |
toDebugString(long maxLength) |
Underlying |
underlyingObject() |
static HeapBytesStore<byte[]> |
wrap(byte[] bytes)
Wraps a byte[].
|
static BytesStore<?,ByteBuffer> |
wrap(ByteBuffer bb)
Wraps a ByteBuffer which can be either on heap or off heap.
|
static PointerBytesStore |
wrap(long address,
long length)
Return the addressForRead and length as a BytesStore
|
default long |
writeLimit() |
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, 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, release, releaseAll, reserve, tryReserve
chars, codePoints, toString
static BytesStore from(@NotNull CharSequence cs)
cs
- to convertstatic HeapBytesStore<byte[]> wrap(@NotNull byte[] bytes)
bytes
- to wrap@NotNull static BytesStore<?,ByteBuffer> wrap(@NotNull ByteBuffer bb)
bb
- to wrap@NotNull static PointerBytesStore nativePointer()
@NotNull static PointerBytesStore wrap(long address, long length)
address
- for the startlength
- of datastatic BytesStore empty()
boolean isDirectMemory()
BytesStore<B,Underlying> copy()
@NotNull default Bytes<Underlying> bytesForRead() throws IllegalStateException
IllegalStateException
- if this Bytes has been released.@NotNull default Bytes<Underlying> bytesForWrite() throws IllegalStateException
IllegalStateException
default boolean isClear()
default long realCapacity()
realCapacity
in interface RandomDataInput
long capacity()
@Nullable Underlying underlyingObject()
default boolean inside(long offset)
default boolean inside(long offset, int buffer)
default long safeLimit()
default long copyTo(@NotNull BytesStore store)
store
- to copy todefault void copyTo(@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 CharSequence subSequence(int start, int end)
subSequence
in interface CharSequence
@NotNull default String toDebugString()
@NotNull default String toDebugString(long maxLength)
maxLength
- the maxiumum len of the output@Nullable default BytesStore bytesStore()
default boolean equalBytes(@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 BytesStore bytesStore)
bytesStore
- to compare withdefault boolean startsWith(@Nullable BytesStore bytesStore)
@NotNull default 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 boolean isEmpty()
default void cipher(@NotNull Cipher cipher, @NotNull Bytes outBytes, @NotNull ByteBuffer using1, @NotNull ByteBuffer using2) throws IllegalStateException
IllegalStateException
default void cipher(@NotNull Cipher cipher, @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()default ByteOrder byteOrder()
boolean compareAndSwapInt(long offset, int expected, int value) throws BufferOverflowException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
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 © 2018. All rights reserved.