public interface Bytes<Underlying> extends BytesStore<Bytes<Underlying>,Underlying>, BytesIn<Underlying>, BytesOut<Underlying>
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_BYTE_BUFFER_CAPACITY |
static int |
MAX_BYTE_BUFFER_CAPACITY |
static long |
MAX_CAPACITY |
charToString
JAVA9_STRING_CODER_LATIN, JAVA9_STRING_CODER_UTF16
Modifier and Type | Method and Description |
---|---|
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() |
static VanillaBytes |
allocateDirect(byte[] bytes)
Creates and returns a new fix sized wrapper for native (64-bit address)
memory with the contents copied from the given
bytes array. |
static VanillaBytes<Void> |
allocateDirect(long capacity)
Creates and returns a new fix sized wrapper for native (64-bit address)
memory with the given
capacity . |
static NativeBytes<Void> |
allocateElasticDirect()
Creates and returns a new elastic wrapper for native (64-bit address)
memory with zero initial capacity which will be resized as required.
|
static NativeBytes<Void> |
allocateElasticDirect(long initialCapacity)
Creates and returns a new elastic wrapper for native (64-bit address)
memory with the given
initialCapacity which will be resized as required. |
default ByteOrder |
byteOrder() |
default Bytes<Underlying> |
bytesForRead()
Creates a slice of the current Bytes based on its position() and limit().
|
BytesStore |
bytesStore() |
Bytes<Underlying> |
clear()
Set the readPosition= writePosition = start, writeLimit = capacity
|
Bytes<Underlying> |
compact()
Compact these Bytes by moving the readPosition to the start.
|
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.
|
BytesStore<Bytes<Underlying>,Underlying> |
copy() |
default long |
copyTo(BytesStore store)
copy bytes from one ByteStore to another
|
default void |
copyTo(OutputStream out) |
static Bytes<ByteBuffer> |
elasticByteBuffer()
Creates and returns a new elastic wrapper for a direct (off-heap) ByteBuffer with a default capacity
which will be resized as required.
|
static Bytes<ByteBuffer> |
elasticByteBuffer(int initialCapacity)
Creates and returns a new elastic wrapper for a direct (off-heap) ByteBuffer with
the given
initialCapacity which will be resized as required. |
static Bytes<ByteBuffer> |
elasticByteBuffer(int initialCapacity,
int maxCapacity)
Creates and returns a new elastic wrapper for a direct (off-heap) ByteBuffer with
the given
initialCapacity which will be resized as required up
to the given maxSize . |
static Bytes<ByteBuffer> |
elasticHeapByteBuffer(int initialCapacity)
Creates and returns a new elastic wrapper for a heap ByteBuffer with
the given
initialCapacity which will be resized as required. |
default void |
ensureCapacity(long size)
grow the buffer if the buffer is elastic, if the buffer is not elastic and there is not
enough capacity then this method will throws
BufferOverflowException |
static Bytes<?> |
from(CharSequence text)
Convert text to bytes using ISO-8859-1 encoding and return a Bytes ready for reading.
|
static Bytes<?> |
from(String text)
Convert text to bytes using ISO-8859-1 encoding and return a Bytes ready for reading.
|
static Bytes |
fromHexString(String s) |
static Bytes<byte[]> |
fromString(String text)
Convert text to bytes using ISO-8859-1 encoding and return a Bytes ready for reading.
|
default long |
indexOf(Bytes source)
Returns the index within this bytes of the first occurrence of the
specified sub-bytes.
|
default long |
indexOf(Bytes source,
int fromIndex)
Deprecated.
|
static int |
indexOf(BytesStore source,
BytesStore target,
int fromIndex)
Code shared by String and StringBuffer to do searches.
|
default int |
indexOf(BytesStore source,
int fromIndex)
Returns the index within this bytes of the first occurrence of the
specified subbytes.
|
default boolean |
isClear()
Returns if the
readPosition is at the start and
the writeLimit is at the end . |
boolean |
isElastic()
Returns if this Bytes is elastic.
|
default boolean |
isEqual(String s) |
int |
lastDecimalPlaces() |
void |
lastDecimalPlaces(int lastDecimalPlaces)
Store the last number of decimal places.
|
default void |
parse8bit(Appendable buffer,
StopCharsTester stopCharsTester)
parse text with ISO-8859-1 decoding as character terminated.
|
default void |
parse8bit(Appendable buffer,
StopCharTester stopCharTester)
parse text with ISO-8859-1 decoding as character terminated.
|
default void |
parse8bit(Bytes buffer,
StopCharsTester stopCharsTester) |
default String |
parse8bit(StopCharTester stopCharTester)
parse text with ISO-8859-1 decoding as character terminated.
|
default void |
parse8bit(StringBuilder buffer,
StopCharsTester stopCharsTester) |
default BigDecimal |
parseBigDecimal() |
default Boolean |
parseBoolean() |
default Boolean |
parseBoolean(StopCharTester tester)
Return true or false, or null if it could not be detected
as true or false.
|
default double |
parseDouble()
parse text as a double decimal.
|
default float |
parseFloat()
parse text as a float decimal.
|
default int |
parseInt()
parse text as an int.
|
default long |
parseLong()
parse text as a long integer.
|
default long |
parseLongDecimal()
Parse the significant digits of a decimal number.
|
default void |
parseUTF(Appendable buffer,
StopCharsTester stopCharsTester)
Deprecated.
|
default void |
parseUTF(Appendable buffer,
StopCharTester stopCharTester)
Deprecated.
|
default String |
parseUTF(StopCharTester stopCharTester)
Deprecated.
|
default void |
parseUtf8(Appendable buffer,
StopCharsTester stopCharsTester)
parse text with UTF-8 decoding as one or two character terminated.
|
default void |
parseUtf8(Appendable buffer,
StopCharTester stopCharTester)
parse text with UTF-8 decoding as character terminated.
|
default String |
parseUtf8(StopCharTester stopCharTester)
parse text with UTF-8 decoding as character terminated.
|
default BigDecimal |
readBigDecimal() |
default BigInteger |
readBigInteger() |
default Reader |
reader()
Access these bytes as an ISO-8859-1 encoded Reader
|
default long |
readLimit() |
default <T extends ReadBytesMarshallable> |
readMarshallableLength16(Class<T> tClass,
T object) |
default long |
readPosition()
The read position must be start() <= readPosition() && readPosition() <= readLimit() && readPosition < safeLimit()
|
default long |
readRemaining() |
default void |
readWithLength(long length,
BytesOut<Underlying> bytesOut) |
default boolean |
readWrite() |
default long |
realCapacity()
Returns the actual capacity that can be potentially read.
|
default long |
safeLimit() |
default boolean |
sharedMemory() |
default boolean |
skipTo(StopCharTester tester)
Skip text until a terminating character is reached.
|
default long |
start() |
void |
testAndSetInt(long offset,
int expected,
int value) |
default String |
toHexString() |
default String |
toHexString(long maxLength)
display the hex data of
Bytes from the position() to the limit() |
default String |
toHexString(long offset,
long maxLength)
display the hex data of
Bytes from the position() to the limit() |
static String |
toString(Bytes<?> buffer)
Creates a string from the
position to the limit , The buffer is not modified
by this call |
static String |
toString(Bytes<?> buffer,
long maxLen)
Creates a string from the
position to the limit , The buffer is not modified
by this call |
static String |
toString(Bytes buffer,
long position,
long len)
The buffer is not modified by this call
|
default boolean |
unchecked() |
default Bytes<Underlying> |
unchecked(boolean unchecked)
Return a Bytes which is optionally unchecked.
|
default void |
unwrite(long fromOffset,
int count)
will unwrite from the offset upto the current write position of the destination bytes
|
static Bytes<byte[]> |
wrapForRead(byte[] byteArray)
Wrap the byte[] ready for reading
Method for convenience only - might not be ideal for performance (creates garbage).
|
static Bytes<ByteBuffer> |
wrapForRead(ByteBuffer byteBuffer)
Wrap the ByteBuffer ready for reading
Method for convenience only - might not be ideal for performance (creates garbage).
|
static Bytes<byte[]> |
wrapForWrite(byte[] byteArray)
Wrap the byte[] ready for writing
Method for convenience only - might not be ideal for performance (creates garbage).
|
static Bytes<ByteBuffer> |
wrapForWrite(ByteBuffer byteBuffer)
Wrap the ByteBuffer ready for writing
Method for convenience only - might not be ideal for performance (creates garbage).
|
default Bytes |
write(InputStream inputStream) |
default long |
writeLimit() |
default void |
writeMarshallableLength16(WriteBytesMarshallable marshallable) |
default long |
writePosition()
The read position must be readPosition() <= writePosition() && writePosition() <= writeLimit()
|
default long |
writeRemaining() |
addAndGetByteNotAtomic, addAndGetDoubleNotAtomic, addAndGetFloatNotAtomic, addAndGetIntNotAtomic, addAndGetLongNotAtomic, addAndGetShortNotAtomic, addAndGetUnsignedByteNotAtomic, addAndGetUnsignedIntNotAtomic, addAndGetUnsignedShortNotAtomic, byteCheckSum, byteCheckSum, bytesForWrite, capacity, charAt, checkRefCount, cipher, cipher, contentEquals, empty, endsWith, equalBytes, inside, inside, isDirectMemory, isEmpty, isPresent, isPresent, length, longCheckSum, move, nativePointer, startsWith, startsWith, subSequence, to8bitString, toDebugString, toDebugString, underlyingObject, wrap, wrap, wrap, writeMaxLong, zeroOut
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
chars, codePoints, toString
bytesMethodReader, bytesMethodReaderBuilder, readObject
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
inputStream, lenient, lenient, nativeRead, parseHexLong, parseUTF, parseUtf8, peekUnsignedByte, rawReadByte, rawReadInt, read, read, read, read, read, read8bit, read8bit, read8bit, read8bit, readBoolean, readByte, readChar, readDouble, readEnum, readFloat, readHistogram, readIncompleteLong, readInt, readInt24, readLimit, readLong, readPosition, readPositionRemaining, readPositionUnlimited, readShort, readSkip, readStopBit, readStopBitChar, readStopBitDecimal, readStopBitDouble, readUnsignedByte, readUnsignedInt, readUnsignedInt24, readUnsignedShort, readUtf8, readUtf8, readUTFΔ, readUTFΔ, readVolatileInt, readVolatileLong, readWithLength, readWithLength, readWithLength0, uncheckedReadSkipBackOne, uncheckedReadSkipOne, uncheckedReadUnsignedByte
bytesMethodWriter, bytesMethodWriterBuilder, writeObject
append, append, append, append, append, append, append, append, append, append, append8bit, append8bit, append8bit, append8bit, append8bit, appendBase, appendBase16, appendBase16, appendDateMillis, appendDecimal, appendTimeMillis, writer
alignBy, appendUtf8, appendUtf8, appendUtf8, appendUtf8, appendUtf8, appendUtf8, canWriteDirect, copyFrom, nativeWrite, outputStream, rawWriteByte, rawWriteInt, realWriteRemaining, write, write, write, write, write, write, write, write, write8bit, write8bit, write8bit, write8bit, writeBigDecimal, writeBigInteger, writeBoolean, writeByte, writeChar, writeDouble, writeDoubleAndInt, writeEnum, writeFloat, writeHistogram, writeInt, writeInt24, writeIntAdv, writeLimit, writeLong, writeLongAdv, writeOrderedInt, writeOrderedLong, writePosition, writePositionRemaining, writeShort, writeSkip, writeSome, writeSome, writeStopBit, writeStopBit, writeStopBit, writeStopBitDecimal, writeUnsignedByte, writeUnsignedInt, writeUnsignedInt24, writeUnsignedShort, writeUtf8, writeUtf8, writeUTFΔ, writeWithLength
refCount, release, release, releaseAll, reserve, tryReserve
clearAndPad, prepend, prewrite, prewrite, prewriteByte, prewriteInt, prewriteLong, prewriteShort
comment, indent, retainsComments
static final long MAX_CAPACITY
static final int MAX_BYTE_BUFFER_CAPACITY
static final int DEFAULT_BYTE_BUFFER_CAPACITY
@NotNull static Bytes<ByteBuffer> elasticByteBuffer()
@NotNull static Bytes<ByteBuffer> elasticByteBuffer(int initialCapacity)
initialCapacity
which will be resized as required.initialCapacity
- the initial non-negative capacity given in bytesinitialCapacity
which will be resized as required@NotNull static Bytes<ByteBuffer> elasticByteBuffer(int initialCapacity, int maxCapacity)
initialCapacity
which will be resized as required up
to the given maxSize
.initialCapacity
- the initial non-negative capacity given in bytesmaxCapacity
- the max capacity given in bytes equal or greater than initialCapacityinitialCapacity
which will be resized as required up
to the given maxSize
@NotNull static Bytes<ByteBuffer> elasticHeapByteBuffer(int initialCapacity)
initialCapacity
which will be resized as required.initialCapacity
- the initial non-negative capacity given in bytesinitialCapacity
which will be resized as required@NotNull static Bytes<ByteBuffer> wrapForRead(@NotNull ByteBuffer byteBuffer)
import net.openhft.chronicle.bytes.Bytes;
import java.nio.ByteBuffer;
public class ChronicleBytesWithByteBufferExampleTest {
private static final String HELLO_WORLD = "hello world";
public static void main(String[] args) throws InterruptedException {
//setup Bytes and ByteBuffer to write from
Bytes b = Bytes.elasticByteBuffer();
ByteBuffer toWriteFrom = ByteBuffer.allocate(HELLO_WORLD.length());
toWriteFrom.put(HELLO_WORLD.getBytes(), 0, HELLO_WORLD.length());
toWriteFrom.flip();
byte[] toReadTo = new byte[HELLO_WORLD.length()];
doWrite(b, toWriteFrom);
ByteBuffer byteBuffer = doRead(b);
//check result
final StringBuilder sb = new StringBuilder();
for (int i = 0; i < HELLO_WORLD.length(); i++) {
sb.append((char) byteBuffer.get());
}
assert sb.toString().equals(HELLO_WORLD): "Failed - strings not equal!";
}
private static void doWrite(Bytes b, ByteBuffer toWrite) {
//no garbage when writing to Bytes from ByteBuffer
b.clear();
b.write(b.writePosition(), toWrite, toWrite.position(), toWrite.limit());
}
private static ByteBuffer doRead(Bytes b) {
//no garbage when getting the underlying ByteBuffer
assert b.underlyingObject() instanceof ByteBuffer;
ByteBuffer byteBuffer = (ByteBuffer) b.underlyingObject();
return byteBuffer;
}
}
byteBuffer
- to wrap@NotNull static Bytes<ByteBuffer> wrapForWrite(@NotNull ByteBuffer byteBuffer)
import net.openhft.chronicle.bytes.Bytes;
import java.nio.ByteBuffer;
public class ChronicleBytesWithByteBufferExampleTest {
private static final String HELLO_WORLD = "hello world";
public static void main(String[] args) throws InterruptedException {
//setup Bytes and ByteBuffer to write from
Bytes b = Bytes.elasticByteBuffer();
ByteBuffer toWriteFrom = ByteBuffer.allocate(HELLO_WORLD.length());
toWriteFrom.put(HELLO_WORLD.getBytes(), 0, HELLO_WORLD.length());
toWriteFrom.flip();
byte[] toReadTo = new byte[HELLO_WORLD.length()];
doWrite(b, toWriteFrom);
ByteBuffer byteBuffer = doRead(b);
//check result
final StringBuilder sb = new StringBuilder();
for (int i = 0; i < HELLO_WORLD.length(); i++) {
sb.append((char) byteBuffer.get());
}
assert sb.toString().equals(HELLO_WORLD): "Failed - strings not equal!";
}
private static void doWrite(Bytes b, ByteBuffer toWrite) {
//no garbage when writing to Bytes from ByteBuffer
b.clear();
b.write(b.writePosition(), toWrite, toWrite.position(), toWrite.limit());
}
private static ByteBuffer doRead(Bytes b) {
//no garbage when getting the underlying ByteBuffer
assert b.underlyingObject() instanceof ByteBuffer;
ByteBuffer byteBuffer = (ByteBuffer) b.underlyingObject();
return byteBuffer;
}
}
byteBuffer
- to wrap@NotNull static Bytes<byte[]> wrapForRead(@NotNull byte[] byteArray)
import net.openhft.chronicle.bytes.Bytes;
import java.nio.charset.Charset;
public class ChronicleBytesWithPrimByteArrayExampleTest {
private static final Charset ISO_8859 = Charset.forName("ISO-8859-1");
private static final String HELLO_WORLD = "hello world";
public static void main(String[] args) {
//setup Bytes and byte[]s to write from and read to
Bytes b = Bytes.elasticByteBuffer();
byte[] toWriteFrom = HELLO_WORLD.getBytes(ISO_8859);
byte[] toReadTo = new byte[HELLO_WORLD.length()];
doWrite(b, toWriteFrom);
doRead(b, toReadTo);
//check result
final StringBuilder sb = new StringBuilder();
for (int i = 0; i < HELLO_WORLD.length(); i++) {
sb.append((char) toReadTo[i]);
}
assert sb.toString().equals(HELLO_WORLD): "Failed - strings not equal!";
}
private static void doWrite(Bytes b, byte[] toWrite) {
//no garbage when writing to Bytes from byte[]
b.clear();
b.write(toWrite);
}
private static void doRead(Bytes b, byte[] toReadTo) {
//no garbage when reading from Bytes into byte[]
b.read( toReadTo, 0, HELLO_WORLD.length());
}
}
byteArray
- to wrap@NotNull static Bytes<byte[]> wrapForWrite(@NotNull byte[] byteArray)
import net.openhft.chronicle.bytes.Bytes;
import java.nio.charset.Charset;
public class ChronicleBytesWithPrimByteArrayExampleTest {
private static final Charset ISO_8859 = Charset.forName("ISO-8859-1");
private static final String HELLO_WORLD = "hello world";
public static void main(String[] args) {
//setup Bytes and byte[]s to write from and read to
Bytes b = Bytes.elasticByteBuffer();
byte[] toWriteFrom = HELLO_WORLD.getBytes(ISO_8859);
byte[] toReadTo = new byte[HELLO_WORLD.length()];
doWrite(b, toWriteFrom);
doRead(b, toReadTo);
//check result
final StringBuilder sb = new StringBuilder();
for (int i = 0; i < HELLO_WORLD.length(); i++) {
sb.append((char) toReadTo[i]);
}
assert sb.toString().equals(HELLO_WORLD): "Failed - strings not equal!";
}
private static void doWrite(Bytes b, byte[] toWrite) {
//no garbage when writing to Bytes from byte[]
b.clear();
b.write(toWrite);
}
private static void doRead(Bytes b, byte[] toReadTo) {
//no garbage when reading from Bytes into byte[]
b.read( toReadTo, 0, HELLO_WORLD.length());
}
}
byteArray
- to wrap@NotNull static Bytes<?> from(@NotNull CharSequence text)
from
in interface BytesStore<Bytes<Underlying>,Underlying>
text
- to convert@NotNull static Bytes<?> from(@NotNull String text)
Note: this returns a direct Bytes now
text
- to convert@NotNull static Bytes<byte[]> fromString(@NotNull String text) throws IllegalArgumentException, IllegalStateException
text
- to convertIllegalArgumentException
IllegalStateException
@NotNull static VanillaBytes<Void> allocateDirect(long capacity) throws IllegalArgumentException
capacity
.capacity
- the non-negative capacity given in bytescapacity
IllegalArgumentException
@NotNull static NativeBytes<Void> allocateElasticDirect()
@NotNull static NativeBytes<Void> allocateElasticDirect(long initialCapacity) throws IllegalArgumentException
initialCapacity
which will be resized as required.initialCapacity
- the initial non-negative capacity given in bytesinitialCapacity
which will be resized as requiredIllegalArgumentException
@NotNull static String toString(@NotNull Bytes<?> buffer) throws BufferUnderflowException
position
to the limit
, The buffer is not modified
by this callbuffer
- the buffer to useposition
to the limit
BufferUnderflowException
@NotNull static String toString(@NotNull Bytes<?> buffer, long maxLen) throws BufferUnderflowException
position
to the limit
, The buffer is not modified
by this callbuffer
- the buffer to usemaxLen
- of the result returnedposition
to the limit
BufferUnderflowException
@NotNull static String toString(@NotNull Bytes buffer, long position, long len) throws BufferUnderflowException
buffer
- the buffer to useposition
- the position to create the string fromlen
- the number of characters to show in the stringposition
BufferUnderflowException
@NotNull static VanillaBytes allocateDirect(@NotNull byte[] bytes) throws IllegalArgumentException
bytes
array.
Changes in the given bytes
will not be affected by writes in
the returned wrapper or vice versa.
bytes
- array to copybytes
arrayIllegalArgumentException
static int indexOf(@NotNull BytesStore source, @NotNull BytesStore target, int fromIndex)
source
- the read bytes being searched.target
- the read bytes being searched for.fromIndex
- the index to begin searching from,@NotNull default Bytes<Underlying> unchecked(boolean unchecked) throws IllegalStateException
this
is elastic.unchecked
- if true, minimal bounds checks will be performed.IllegalStateException
- if the underlying BytesStore has been releaseddefault boolean unchecked()
default long safeLimit()
safeLimit
in interface BytesStore<Bytes<Underlying>,Underlying>
default boolean isClear()
BytesStore
readPosition
is at the start
and
the writeLimit
is at the end
.
I.e start() == readPosition() && writeLimit() == capacity()
isClear
in interface BytesStore<Bytes<Underlying>,Underlying>
readPosition
is at the start
and
the writeLimit
is at the end
default long realCapacity()
RandomDataInput
realCapacity
in interface BytesStore<Bytes<Underlying>,Underlying>
realCapacity
in interface RandomDataInput
realCapacity
in interface StreamingDataOutput<Bytes<Underlying>>
BytesStore<Bytes<Underlying>,Underlying> copy()
copy
in interface BytesStore<Bytes<Underlying>,Underlying>
@NotNull default String toHexString()
@NotNull default String toHexString(long maxLength)
Bytes
from the position() to the limit()maxLength
- limit the number of bytes to be dumped.@NotNull default String toHexString(long offset, long maxLength)
Bytes
from the position() to the limit()maxLength
- limit the number of bytes to be dumped.boolean isElastic()
realCapacity()
.default void ensureCapacity(long size) throws IllegalArgumentException
BufferOverflowException
size
- the capacity that you requiredIllegalArgumentException
- if the buffer is not elastic and there is not enough space@NotNull default Bytes<Underlying> bytesForRead() throws IllegalStateException
bytesForRead
in interface BytesStore<Bytes<Underlying>,Underlying>
IllegalStateException
- if the underlying BytesStore has been released@Nullable BytesStore bytesStore()
bytesStore
in interface BytesStore<Bytes<Underlying>,Underlying>
default boolean isEqual(String s)
@NotNull Bytes<Underlying> compact()
default long copyTo(@NotNull BytesStore store)
copyTo
in interface BytesStore<Bytes<Underlying>,Underlying>
store
- to copy todefault void copyTo(OutputStream out) throws IOException
copyTo
in interface BytesStore<Bytes<Underlying>,Underlying>
IOException
default boolean sharedMemory()
default void unwrite(long fromOffset, int count)
fromOffset
- the offset from the target byytescount
- the number of bytes to un-write@NotNull default BigDecimal readBigDecimal()
@NotNull default BigInteger readBigInteger()
default long indexOf(@NotNull Bytes source)
The returned index is the smallest value k for which:
If no such value of k exists, thenthis.startsWith(bytes, k)
-1
is returned.source
- the sub-bytes to search for.-1
if there is no such occurrence.default int indexOf(@NotNull BytesStore source, int fromIndex)
The returned index is the smallest value k for which:
If no such value of k exists, thenthis.startsWith(bytes, k)
-1
is returned.source
- the sub-bytes to search for.fromIndex
- start the seach from this offset-1
if there is no such occurrence.@Deprecated default long indexOf(@NotNull Bytes source, int fromIndex)
@NotNull Bytes<Underlying> clear()
StreamingCommon
clear
in interface StreamingCommon<Bytes<Underlying>>
default boolean readWrite()
readWrite
in interface BytesStore<Bytes<Underlying>,Underlying>
default void readWithLength(long length, @NotNull BytesOut<Underlying> bytesOut) throws BufferUnderflowException, net.openhft.chronicle.core.io.IORuntimeException
BufferUnderflowException
net.openhft.chronicle.core.io.IORuntimeException
default <T extends ReadBytesMarshallable> T readMarshallableLength16(Class<T> tClass, T object)
readMarshallableLength16
in interface BytesIn<Underlying>
default void writeMarshallableLength16(WriteBytesMarshallable marshallable)
writeMarshallableLength16
in interface BytesOut<Underlying>
default Bytes write(InputStream inputStream) throws IOException
IOException
@NotNull default Reader reader()
@Nullable default Boolean parseBoolean(@NotNull StopCharTester tester)
false: f, false, n, no, 0
true: t, true, y, yes, 1
tester
- to detect the end of the text.@Nullable default Boolean parseBoolean()
@NotNull default String parseUtf8(@NotNull StopCharTester stopCharTester)
stopCharTester
- to check if the end has been reached.@NotNull @Deprecated default String parseUTF(@NotNull StopCharTester stopCharTester)
default void parseUtf8(@NotNull Appendable buffer, @NotNull StopCharTester stopCharTester) throws BufferUnderflowException
buffer
- to populatestopCharTester
- to check if the end has been reached.BufferUnderflowException
@Deprecated default void parseUTF(@NotNull Appendable buffer, @NotNull StopCharTester stopCharTester) throws BufferUnderflowException
BufferUnderflowException
default void parseUtf8(@NotNull Appendable buffer, @NotNull StopCharsTester stopCharsTester) throws BufferUnderflowException, net.openhft.chronicle.core.io.IORuntimeException
buffer
- to populatestopCharsTester
- to check if the end has been reached.BufferUnderflowException
net.openhft.chronicle.core.io.IORuntimeException
@Deprecated default void parseUTF(@NotNull Appendable buffer, @NotNull StopCharsTester stopCharsTester) throws BufferUnderflowException, net.openhft.chronicle.core.io.IORuntimeException
BufferUnderflowException
net.openhft.chronicle.core.io.IORuntimeException
default void parse8bit(Appendable buffer, @NotNull StopCharTester stopCharTester) throws BufferUnderflowException
buffer
- to populatestopCharTester
- to check if the end has been reached.BufferUnderflowException
default String parse8bit(@NotNull StopCharTester stopCharTester) throws BufferUnderflowException
stopCharTester
- to check if the end has been reached.BufferUnderflowException
default void parse8bit(Appendable buffer, @NotNull StopCharsTester stopCharsTester) throws BufferUnderflowException
buffer
- to populatestopCharsTester
- to check if the end has been reached.BufferUnderflowException
default void parse8bit(Bytes buffer, @NotNull StopCharsTester stopCharsTester) throws BufferUnderflowException
BufferUnderflowException
default void parse8bit(StringBuilder buffer, @NotNull StopCharsTester stopCharsTester) throws BufferUnderflowException
BufferUnderflowException
default int parseInt() throws BufferUnderflowException
BufferUnderflowException
default long parseLong() throws BufferUnderflowException
BufferUnderflowException
default float parseFloat() throws BufferUnderflowException
The number of decimal places can be retrieved with lastDecimalPlaces()
BufferUnderflowException
default double parseDouble() throws BufferUnderflowException
The number of decimal places can be retrieved with lastDecimalPlaces()
BufferUnderflowException
default long parseLongDecimal() throws BufferUnderflowException
The number of decimal places can be retrieved with lastDecimalPlaces()
BufferUnderflowException
int lastDecimalPlaces()
void lastDecimalPlaces(int lastDecimalPlaces)
lastDecimalPlaces
- set the number of decimal places if positive, otherwise 0.default boolean skipTo(@NotNull StopCharTester tester)
tester
- to stop at@NotNull default BigDecimal parseBigDecimal()
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
Copyright © 2019. All rights reserved.