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 long |
copyTo(BytesStore store)
Copy the data to another BytesStore
|
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 |
isClear()
The Bytes are clear if start() == readPosition() && writeLimit() == capacity()
|
default boolean |
isNative() |
default boolean |
isPresent() |
default void |
isPresent(boolean isPresent)
Clear and set the flag for present.
|
default int |
length() |
default long |
longCheckSum()
Return the long sum of the readable bytes.
|
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 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 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 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, 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, 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
close, refCount, release, release, releaseAll, reserve, tryReserve
closeQuietly, isClosed, notifyClosing
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 datastatic BytesStore empty()
default boolean isNative()
BytesStore<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 long copyTo(@NotNull BytesStore store) throws IllegalStateException, net.openhft.chronicle.core.io.IORuntimeException
store
- to copy toIllegalStateException
net.openhft.chronicle.core.io.IORuntimeException
default void copyTo(OutputStream out) throws IOException
IOException
default B zeroOut(long start, long end) throws IllegalArgumentException, net.openhft.chronicle.core.io.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
net.openhft.chronicle.core.io.IORuntimeException
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 outputdefault BytesStore bytesStore()
default boolean equalBytes(@NotNull BytesStore bytesStore, long length) throws BufferUnderflowException, net.openhft.chronicle.core.io.IORuntimeException
bytesStore
- to match againstlength
- to match.BufferUnderflowException
net.openhft.chronicle.core.io.IORuntimeException
default int byteCheckSum() throws net.openhft.chronicle.core.io.IORuntimeException
net.openhft.chronicle.core.io.IORuntimeException
default long longCheckSum() throws net.openhft.chronicle.core.io.IORuntimeException
net.openhft.chronicle.core.io.IORuntimeException
default boolean endsWith(char c) throws net.openhft.chronicle.core.io.IORuntimeException
c
- to look fornet.openhft.chronicle.core.io.IORuntimeException
default boolean startsWith(char c) throws net.openhft.chronicle.core.io.IORuntimeException
c
- to look fornet.openhft.chronicle.core.io.IORuntimeException
default boolean contentEquals(@Nullable BytesStore bytesStore) throws net.openhft.chronicle.core.io.IORuntimeException
bytesStore
- to compare withnet.openhft.chronicle.core.io.IORuntimeException
default boolean startsWith(@Nullable BytesStore bytesStore) throws net.openhft.chronicle.core.io.IORuntimeException
net.openhft.chronicle.core.io.IORuntimeException
default String to8bitString() throws net.openhft.chronicle.core.io.IORuntimeException, IllegalArgumentException
net.openhft.chronicle.core.io.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 void isPresent(boolean isPresent)
isPresent
- if there is data, or false if not.default boolean isPresent()
void move(long from, long to, long length)
default void writeMaxLong(long offset, long atLeast)
offset
- to write toatLeast
- value it is at least.default 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, net.openhft.chronicle.core.io.IORuntimeException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
IllegalArgumentException
net.openhft.chronicle.core.io.IORuntimeException
boolean compareAndSwapLong(long offset, long expected, long value) throws BufferOverflowException, IllegalArgumentException, net.openhft.chronicle.core.io.IORuntimeException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
IllegalArgumentException
net.openhft.chronicle.core.io.IORuntimeException
default boolean compareAndSwapFloat(long offset, float expected, float value) throws BufferOverflowException, IllegalArgumentException, net.openhft.chronicle.core.io.IORuntimeException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
IllegalArgumentException
net.openhft.chronicle.core.io.IORuntimeException
default boolean compareAndSwapDouble(long offset, double expected, double value) throws BufferOverflowException, IllegalArgumentException, net.openhft.chronicle.core.io.IORuntimeException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
IllegalArgumentException
net.openhft.chronicle.core.io.IORuntimeException
boolean sharedMemory()
Copyright © 2016. All rights reserved.