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)
Perform a not atomic add and get operation for a byte value.
|
default double |
addAndGetDoubleNotAtomic(long offset,
double adding)
Perform a not atomic add and get operation for a double 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 long |
addAndGetLongNotAtomic(long offset,
long adding)
Perform a not atomic add and get operation for 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.
|
default long |
addAndGetUnsignedIntNotAtomic(long offset,
long adding)
Perform a not atomic add and get operation for an unsigned int value.
|
default int |
addAndGetUnsignedShortNotAtomic(long offset,
int adding)
Perform a not atomic add and get operation for an unsigned short value.
|
long |
address(long offset)
Obtain the underlying address.
|
default int |
byteCheckSum()
Return the bytes sum of the readable bytes.
|
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 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 void |
copyTo(BytesStore store)
Copy the data to another BytesStore
|
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 |
isClear()
The Bytes are clear if start() == readPosition() && writeLimit() == capacity()
|
default int |
length() |
default long |
longCheckSum()
Return the long sum of the readable bytes.
|
static PointerBytesStore |
nativePointer() |
default long |
readLimit() |
default long |
readPosition()
The read position must be start() <= readPosition() && readPosition() <= readLimit() && readPosition < safeLimit()
|
default long |
readRemaining() |
default long |
realCapacity() |
default long |
safeLimit() |
default long |
start() |
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() |
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 BytesStore |
wrap(CharSequence cs)
Deprecated.
Use from(CharSequence) instead.
|
static PointerBytesStore |
wrap(long address,
long length)
Return the address and length as a BytesStore
|
default long |
writeLimit() |
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, copyTo, createCharToString, findByte, nativeRead, parseLong, printable, readBoolean, readByte, readDouble, readFloat, readIncompleteLong, readInt, readLong, readShort, readUnsignedByte, readUnsignedInt, readUnsignedShort, readUtf8, readUtf8Limited, readUtf8Limited, readVolatileByte, readVolatileDouble, readVolatileFloat, readVolatileInt, readVolatileLong, readVolatileShort, subBytes
append, nativeWrite, write, write, write, write, write, writeBoolean, writeByte, writeByte, writeDouble, writeFloat, writeInt, writeLong, writeOrderedDouble, writeOrderedFloat, writeOrderedInt, writeOrderedLong, writeShort, writeUnsignedByte, writeUnsignedInt, writeUnsignedShort, writeUtf8, writeUtf8Limited, writeVolatileByte, writeVolatileDouble, writeVolatileFloat, writeVolatileInt, writeVolatileLong, writeVolatileShort
close, refCount, release, release, releaseAll, reserve, tryReserve
chars, codePoints, toString
@Deprecated static BytesStore wrap(@NotNull CharSequence cs)
static BytesStore from(@NotNull CharSequence cs)
cs
- to convertstatic HeapBytesStore<byte[]> wrap(@NotNull byte[] bytes)
bytes
- to wrapstatic BytesStore<?,ByteBuffer> wrap(@NotNull ByteBuffer bb)
bb
- to wrap@NotNull static PointerBytesStore nativePointer()
static PointerBytesStore wrap(long address, long length)
address
- for the startlength
- of dataBytesStore<B,Underlying> copy() throws IllegalArgumentException
IllegalArgumentException
default Bytes<Underlying> bytesForRead() throws IllegalStateException
IllegalStateException
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 long safeLimit()
default void copyTo(@NotNull BytesStore store) throws IllegalStateException, IORuntimeException
store
- to copy toIllegalStateException
IORuntimeException
default B zeroOut(long start, long end) throws IllegalArgumentException, IORuntimeException
zeroOut
in interface RandomDataOutput<B extends BytesStore<B,Underlying>>
start
- first byte inclusiveend
- last byte exclusive.IORuntimeException
- if the underlying buffer fails to resize.IllegalArgumentException
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()
default BytesStore bytesStore()
default boolean equalBytes(@NotNull BytesStore bytesStore, long length) throws BufferUnderflowException, IORuntimeException
bytesStore
- to match againstlength
- to match.BufferUnderflowException
IORuntimeException
default int byteCheckSum() throws IORuntimeException
IORuntimeException
default long longCheckSum() throws IORuntimeException
IORuntimeException
default boolean endsWith(char c) throws IORuntimeException
c
- to look forIORuntimeException
default boolean startsWith(char c) throws IORuntimeException
c
- to look forIORuntimeException
default boolean contentEquals(@Nullable BytesStore bytesStore) throws IORuntimeException
bytesStore
- to compare withIORuntimeException
default String to8bitString() throws IORuntimeException, IllegalArgumentException
default byte addAndGetByteNotAtomic(long offset, byte adding)
offset
- to add and getadding
- value to add, can be 1default int addAndGetUnsignedByteNotAtomic(long offset, int adding)
offset
- to add and getadding
- value to add, can be 1default short addAndGetShortNotAtomic(long offset, short adding)
offset
- to add and getadding
- value to add, can be 1default int addAndGetUnsignedShortNotAtomic(long offset, int adding)
offset
- to add and getadding
- value to add, can be 1default int addAndGetIntNotAtomic(long offset, int adding)
offset
- to add and getadding
- value to add, can be 1default long addAndGetUnsignedIntNotAtomic(long offset, long adding)
offset
- to add and getadding
- value to add, can be 1default long addAndGetLongNotAtomic(long offset, long adding)
offset
- to add and getadding
- value to add, can be 1default float addAndGetFloatNotAtomic(long offset, float adding)
offset
- to add and getadding
- value to add, can be 1default double addAndGetDoubleNotAtomic(long offset, double adding)
offset
- to add and getadding
- value to add, can be 1default long start()
default long readPosition()
default long writePosition()
default long readRemaining()
default long writeRemaining()
default long readLimit()
default long writeLimit()
long address(long offset) throws UnsupportedOperationException, IllegalArgumentException
offset
- within this buffer. address(start()) is the actual address of the first byte.UnsupportedOperationException
- if the underlying buffer is on the heapIllegalArgumentException
- 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, IllegalArgumentException, IORuntimeException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
IllegalArgumentException
IORuntimeException
boolean compareAndSwapLong(long offset, long expected, long value) throws BufferOverflowException, IllegalArgumentException, IORuntimeException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
IllegalArgumentException
IORuntimeException
default boolean compareAndSwapFloat(long offset, float expected, float value) throws BufferOverflowException, IllegalArgumentException, IORuntimeException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
IllegalArgumentException
IORuntimeException
default boolean compareAndSwapDouble(long offset, double expected, double value) throws BufferOverflowException, IllegalArgumentException, IORuntimeException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
IllegalArgumentException
IORuntimeException
Copyright © 2015. All rights reserved.