public class VanillaBytes<Underlying> extends AbstractBytes<Underlying> implements Byteable<Bytes<Underlying>,Underlying>, Comparable<CharSequence>
bytesStore, isPresent, readPosition, writeLimit, writePositionDEFAULT_BYTE_BUFFER_CAPACITY, MAX_BYTE_BUFFER_CAPACITY, MAX_CAPACITYcharToStringJAVA9_STRING_CODER_LATIN, JAVA9_STRING_CODER_UTF16| Constructor and Description |
|---|
VanillaBytes(@NotNull BytesStore bytesStore) |
VanillaBytes(@NotNull BytesStore bytesStore,
long writePosition,
long writeLimit) |
| Modifier and Type | Method and Description |
|---|---|
default long |
addressForRead(long offset,
int buffer) |
@NotNull VanillaBytes |
append(@NotNull CharSequence str,
int start,
int end)
Append a portion of a String to the Bytes in UTF-8.
|
@NotNull Bytes<Underlying> |
append8bit(@NotNull BytesStore bs) |
@NotNull Bytes<Underlying> |
append8bit(@NotNull CharSequence cs)
Append a String to the Bytes in ISO-8859-1
|
@NotNull Bytes<Underlying> |
append8bit(@NotNull String cs) |
protected @NotNull Bytes<Underlying> |
append8bit0(@NotNull CharSequence cs) |
@NotNull Bytes<Underlying> |
appendUtf8(char[] chars,
int offset,
int length) |
@NotNull VanillaBytes |
appendUtf8(CharSequence str) |
int |
byteCheckSum(int start,
int end) |
default ByteOrder |
byteOrder() |
@NotNull Bytes<Underlying> |
bytesForRead()
Creates a slice of the current Bytes based on its position() and limit().
|
void |
bytesStore(@NotNull BytesStore<Bytes<Underlying>,Underlying> byteStore,
long offset,
long length)
This setter for a data type which points to an underlying ByteStore.
|
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.
|
int |
compareTo(@NotNull CharSequence cs) |
@NotNull BytesStore<Bytes<Underlying>,Underlying> |
copy() |
boolean |
equalBytes(BytesStore bytesStore,
long length)
Check if a portion of a BytesStore matches this one.
|
boolean |
isElastic()
Returns if this Bytes is elastic.
|
boolean |
isEqual(@Nullable String s) |
long |
maxSize() |
long |
offset() |
protected void |
optimisedWrite(@NotNull RandomDataInput bytes,
long offset,
long length) |
default void |
parse8bit(Appendable buffer,
@NotNull StopCharsTester stopCharsTester)
parse text with ISO-8859-1 decoding as character terminated.
|
default void |
parse8bit(Appendable buffer,
@NotNull StopCharTester stopCharTester)
parse text with ISO-8859-1 decoding as character terminated.
|
default void |
parse8bit(Bytes buffer,
@NotNull StopCharsTester stopCharsTester) |
default String |
parse8bit(@NotNull StopCharTester stopCharTester)
parse text with ISO-8859-1 decoding as character terminated.
|
default void |
parse8bit(StringBuilder buffer,
@NotNull StopCharsTester stopCharsTester) |
default @NotNull BigDecimal |
parseBigDecimal() |
default @Nullable Boolean |
parseBoolean() |
default @Nullable Boolean |
parseBoolean(@NotNull 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(@NotNull Appendable buffer,
@NotNull StopCharsTester stopCharsTester)
Deprecated.
|
default void |
parseUTF(@NotNull Appendable buffer,
@NotNull StopCharTester stopCharTester)
Deprecated.
|
default @NotNull String |
parseUTF(@NotNull StopCharTester stopCharTester)
Deprecated.
|
default void |
parseUtf8(@NotNull Appendable buffer,
@NotNull StopCharsTester stopCharsTester)
parse text with UTF-8 decoding as one or two character terminated.
|
default void |
parseUtf8(@NotNull Appendable buffer,
@NotNull StopCharTester stopCharTester)
parse text with UTF-8 decoding as character terminated.
|
default @NotNull String |
parseUtf8(@NotNull StopCharTester stopCharTester)
parse text with UTF-8 decoding as character terminated.
|
int |
read(@NotNull byte[] bytes) |
void |
read8Bit(char[] chars,
int length) |
default @NotNull Reader |
reader()
Access these bytes as an ISO-8859-1 encoded Reader
|
default long |
readRemaining() |
long |
readVolatileLong(long offset)
Read a 64-bit long from memory with a load barrier.
|
long |
realCapacity()
Returns the actual capacity that can be potentially read.
|
default boolean |
skipTo(@NotNull StopCharTester tester)
Skip text until a terminating character is reached.
|
@NotNull String |
toString() |
protected @NotNull String |
toString0() |
ByteBuffer |
toTemporaryDirectByteBuffer() |
static @NotNull VanillaBytes<Void> |
vanillaBytes() |
@NotNull Bytes<Underlying> |
write(@NotNull BytesStore bytes,
long offset,
long length)
Write all data or fail.
|
void |
write(long position,
@NotNull CharSequence str,
int offset,
int length) |
@NotNull Bytes<Underlying> |
write(@NotNull RandomDataInput bytes,
long offset,
long length)
Write all data or fail.
|
default long |
writeRemaining() |
addressForRead, addressForWrite, addressForWritePosition, append, byteCheckSum, byteCheckSum, bytesStore, canReadDirect, canWriteDirect, capacity, checkRefCount, clear, clearAndPad, compact, compareAndSwapInt, compareAndSwapLong, equals, equalsBytes, hashCode, isDirectMemory, isPresent, isPresent, lastDecimalPlaces, lastDecimalPlaces, lenient, lenient, move, nativeRead, nativeRead, nativeWrite, nativeWrite, peekUnsignedByte, peekUnsignedByte, prewrite, prewrite, prewriteByte, prewriteInt, prewriteLong, prewriteOffsetPositionMoved, prewriteShort, readByte, readByte, readDouble, readDouble, readFloat, readFloat, readInt, readInt, readLimit, readLimit, readLong, readLong, readOffsetPositionMoved, readPosition, readPosition, readShort, readShort, readSkip, readUnsignedByte, readUnsignedByte, readVolatileByte, readVolatileInt, readVolatileInt, readVolatileLong, readVolatileShort, realWriteRemaining, refCount, release, reserve, safeCopySize, start, testAndSetInt, tryReserve, uncheckedReadSkipBackOne, uncheckedReadSkipOne, uncheckedReadUnsignedByte, underlyingObject, write, write, write, write, write, writeByte, writeByte, writeCheckOffset0, writeDouble, writeDouble, writeDoubleAndInt, writeFloat, writeFloat, writeInt, writeInt, writeIntAdv, writeLimit, writeLimit, writeLong, writeLong, writeLongAdv, writeOffsetPositionMoved, writeOffsetPositionMoved, writeOrderedInt, writeOrderedInt, writeOrderedLong, writeOrderedLong, writePosition, writePosition, writeShort, writeShort, writeSkip, writeSome, writeVolatileByte, writeVolatileInt, writeVolatileLong, writeVolatileShortclone, finalize, getClass, notify, notifyAll, wait, wait, waitbytesStoreallocateDirect, allocateDirect, allocateElasticDirect, allocateElasticDirect, copyTo, copyTo, elasticByteBuffer, elasticByteBuffer, elasticByteBuffer, elasticHeapByteBuffer, ensureCapacity, from, from, fromHexString, fromString, indexOf, indexOf, indexOf, indexOf, isClear, readBigDecimal, readBigInteger, readMarshallableLength16, readWithLength, readWrite, safeLimit, sharedMemory, toHexString, toHexString, toHexString, toString, toString, toString, unchecked, unchecked, unwrite, wrapForRead, wrapForRead, wrapForWrite, wrapForWrite, write, writeMarshallableLength16addAndGetByteNotAtomic, addAndGetDoubleNotAtomic, addAndGetFloatNotAtomic, addAndGetIntNotAtomic, addAndGetLongNotAtomic, addAndGetShortNotAtomic, addAndGetUnsignedByteNotAtomic, addAndGetUnsignedIntNotAtomic, addAndGetUnsignedShortNotAtomic, bytesForWrite, charAt, cipher, cipher, contentEquals, empty, endsWith, inside, inside, isEmpty, length, longCheckSum, nativePointer, startsWith, startsWith, subSequence, to8bitString, toDebugString, toDebugString, wrap, wrap, wrap, writeMaxLong, zeroOutappend, append, write, write, writeBoolean, writeByte, writeInt24, writeOrderedDouble, writeOrderedFloat, writeUnsignedByte, writeUnsignedInt, writeUnsignedShort, writeUtf8, writeUtf8Limited, writeVolatileDouble, writeVolatileFloatchars, codePointsbytesMethodReader, bytesMethodReaderBuilder, readObjectaddAndGetDouble, addAndGetFloat, addAndGetInt, addAndGetLong, compareUtf8, copyTo, copyTo, createCharToString, fastHash, findByte, parseLong, peekVolatileInt, printable, read, readBoolean, readIncompleteLong, readUnsignedInt, readUnsignedInt24, readUnsignedShort, readUtf8, readUtf8Limited, readUtf8Limited, readVolatileDouble, readVolatileFloat, subBytes, toByteArrayinputStream, parseHexLong, parseUTF, parseUtf8, rawReadByte, rawReadInt, read, read, read, read, read8bit, read8bit, read8bit, read8bit, readBoolean, readChar, readEnum, readHistogram, readIncompleteLong, readInt24, readPositionRemaining, readPositionUnlimited, readStopBit, readStopBitChar, readStopBitDecimal, readStopBitDouble, readUnsignedInt, readUnsignedInt24, readUnsignedShort, readUtf8, readUtf8, readUTFΔ, readUTFΔ, readWithLength, readWithLength, readWithLength0bytesMethodWriter, bytesMethodWriterBuilder, writeObjectappend, append, append, append, append, append, append, append, append8bit, append8bit, appendBase, appendBase16, appendBase16, appendDateMillis, appendDecimal, appendTimeMillis, writeralignBy, appendUtf8, appendUtf8, appendUtf8, appendUtf8, copyFrom, outputStream, rawWriteByte, rawWriteInt, write, write, write, write, write8bit, write8bit, write8bit, write8bit, writeBigDecimal, writeBigInteger, writeBoolean, writeChar, writeEnum, writeHistogram, writeInt24, writePositionRemaining, writeSome, writeStopBit, writeStopBit, writeStopBit, writeStopBitDecimal, writeUnsignedByte, writeUnsignedInt, writeUnsignedInt24, writeUnsignedShort, writeUtf8, writeUtf8, writeUTFΔ, writeWithLengthprependcomment, indent, retainsCommentspublic VanillaBytes(@NotNull
@NotNull BytesStore bytesStore)
throws IllegalStateException
IllegalStateExceptionpublic VanillaBytes(@NotNull
@NotNull BytesStore bytesStore,
long writePosition,
long writeLimit)
throws IllegalStateException
IllegalStateException@NotNull public static @NotNull VanillaBytes<Void> vanillaBytes()
public long readVolatileLong(long offset)
throws BufferUnderflowException
RandomDataInputreadVolatileLong in interface RandomDataInputreadVolatileLong in class AbstractBytes<Underlying>offset - to readBufferUnderflowException - if the offset is outside the limits of the Bytespublic void bytesStore(@NotNull
@NotNull BytesStore<Bytes<Underlying>,Underlying> byteStore,
long offset,
long length)
throws IllegalStateException,
BufferOverflowException,
BufferUnderflowException
ByteablebytesStore in interface Byteable<Bytes<Underlying>,Underlying>byteStore - the fix point ByteStoreoffset - the offset within the ByteStorelength - the length in the ByteStoreIllegalStateExceptionBufferOverflowExceptionBufferUnderflowExceptionpublic long offset()
offset in interface Byteable<Bytes<Underlying>,Underlying>public long maxSize()
maxSize in interface Byteable<Bytes<Underlying>,Underlying>public boolean isElastic()
BytesBytes.realCapacity().isElastic in interface Bytes<Underlying>@NotNull public @NotNull Bytes<Underlying> bytesForRead() throws IllegalStateException
BytesbytesForRead in interface Bytes<Underlying>bytesForRead in interface BytesStore<Bytes<Underlying>,Underlying>IllegalStateException - if the underlying BytesStore has been releasedpublic boolean isEqual(@Nullable
@Nullable String s)
isEqual in interface Bytes<Underlying>public long realCapacity()
RandomDataInputrealCapacity in interface Bytes<Underlying>realCapacity in interface BytesStore<Bytes<Underlying>,Underlying>realCapacity in interface RandomDataInputrealCapacity in interface StreamingDataOutput<Bytes<Underlying>>realCapacity in class AbstractBytes<Underlying>@NotNull public @NotNull BytesStore<Bytes<Underlying>,Underlying> copy()
copy in interface Bytes<Underlying>copy in interface BytesStore<Bytes<Underlying>,Underlying>@NotNull public @NotNull Bytes<Underlying> write(@NotNull @NotNull RandomDataInput bytes, long offset, long length) throws BufferOverflowException, BufferUnderflowException, IllegalArgumentException
StreamingDataOutputwrite in interface StreamingDataOutput<Bytes<Underlying>>BufferOverflowExceptionBufferUnderflowExceptionIllegalArgumentExceptionprotected void optimisedWrite(@NotNull
@NotNull RandomDataInput bytes,
long offset,
long length)
public void write(long position,
@NotNull
@NotNull CharSequence str,
int offset,
int length)
throws BufferOverflowException,
IllegalArgumentException
@NotNull public @NotNull VanillaBytes append(@NotNull @NotNull CharSequence str, int start, int end) throws IndexOutOfBoundsException
ByteStringAppenderappend in interface Appendableappend in interface ByteStringAppender<Bytes<Underlying>>str - to copystart - index of the first char inclusiveend - index of the last char exclusive.IndexOutOfBoundsException@NotNull public @NotNull VanillaBytes appendUtf8(CharSequence str) throws BufferOverflowException
appendUtf8 in interface StreamingDataOutput<Bytes<Underlying>>BufferOverflowException@NotNull public @NotNull Bytes<Underlying> append8bit(@NotNull @NotNull CharSequence cs) throws BufferOverflowException, BufferUnderflowException, IndexOutOfBoundsException
ByteStringAppenderappend8bit in interface ByteStringAppender<Bytes<Underlying>>cs - to writeBufferOverflowException - If the string as too large to write in the capacity availableBufferUnderflowException - if the capacity of the underlying buffer was exceededIndexOutOfBoundsException@NotNull public @NotNull Bytes<Underlying> append8bit(@NotNull @NotNull BytesStore bs) throws BufferOverflowException, BufferUnderflowException, IndexOutOfBoundsException
append8bit in interface ByteStringAppender<Bytes<Underlying>>BufferOverflowExceptionBufferUnderflowExceptionIndexOutOfBoundsException@NotNull public @NotNull Bytes<Underlying> write(@NotNull @NotNull BytesStore bytes, long offset, long length) throws BufferOverflowException, BufferUnderflowException
StreamingDataOutputwrite in interface StreamingDataOutput<Bytes<Underlying>>BufferOverflowExceptionBufferUnderflowException@NotNull public @NotNull Bytes<Underlying> append8bit(@NotNull @NotNull String cs) throws BufferOverflowException, BufferUnderflowException, IndexOutOfBoundsException
append8bit in interface ByteStringAppender<Bytes<Underlying>>BufferOverflowExceptionBufferUnderflowExceptionIndexOutOfBoundsException@NotNull public @NotNull String toString()
toString in interface CharSequencetoString in class AbstractBytes<Underlying>@NotNull protected @NotNull String toString0()
@NotNull protected @NotNull Bytes<Underlying> append8bit0(@NotNull @NotNull CharSequence cs) throws BufferOverflowException, IndexOutOfBoundsException
public boolean equalBytes(BytesStore bytesStore, long length) throws BufferUnderflowException
BytesStoreequalBytes in interface BytesStore<Bytes<Underlying>,Underlying>bytesStore - to match againstlength - to match.BufferUnderflowExceptionpublic void read8Bit(char[] chars,
int length)
public int byteCheckSum(int start,
int end)
throws net.openhft.chronicle.core.io.IORuntimeException
byteCheckSum in class AbstractBytes<Underlying>net.openhft.chronicle.core.io.IORuntimeException@NotNull public @NotNull Bytes<Underlying> appendUtf8(char[] chars, int offset, int length) throws BufferOverflowException, IllegalArgumentException
appendUtf8 in interface StreamingDataOutput<Bytes<Underlying>>BufferOverflowExceptionIllegalArgumentExceptionpublic ByteBuffer toTemporaryDirectByteBuffer() throws IllegalArgumentException
toTemporaryDirectByteBuffer in interface RandomDataInputIllegalArgumentExceptionpublic int read(@NotNull
@NotNull byte[] bytes)
public int compareTo(@NotNull
@NotNull CharSequence cs)
compareTo in interface Comparable<CharSequence>@NotNull public @NotNull Reader reader()
@Nullable public @Nullable Boolean parseBoolean(@NotNull @NotNull StopCharTester tester)
false: f, false, n, no, 0
true: t, true, y, yes, 1
tester - to detect the end of the text.@Nullable public @Nullable Boolean parseBoolean()
@NotNull public @NotNull String parseUtf8(@NotNull @NotNull StopCharTester stopCharTester)
stopCharTester - to check if the end has been reached.@NotNull @Deprecated public @NotNull String parseUTF(@NotNull @NotNull StopCharTester stopCharTester)
public void parseUtf8(@NotNull
@NotNull Appendable buffer,
@NotNull
@NotNull StopCharTester stopCharTester)
throws BufferUnderflowException
buffer - to populatestopCharTester - to check if the end has been reached.BufferUnderflowException@Deprecated public void parseUTF(@NotNull @NotNull Appendable buffer, @NotNull @NotNull StopCharTester stopCharTester) throws BufferUnderflowException
BufferUnderflowExceptionpublic void parseUtf8(@NotNull
@NotNull Appendable buffer,
@NotNull
@NotNull StopCharsTester stopCharsTester)
throws BufferUnderflowException,
net.openhft.chronicle.core.io.IORuntimeException
buffer - to populatestopCharsTester - to check if the end has been reached.BufferUnderflowExceptionnet.openhft.chronicle.core.io.IORuntimeException@Deprecated public void parseUTF(@NotNull @NotNull Appendable buffer, @NotNull @NotNull StopCharsTester stopCharsTester) throws BufferUnderflowException, net.openhft.chronicle.core.io.IORuntimeException
BufferUnderflowExceptionnet.openhft.chronicle.core.io.IORuntimeExceptionpublic void parse8bit(Appendable buffer, @NotNull @NotNull StopCharTester stopCharTester) throws BufferUnderflowException
buffer - to populatestopCharTester - to check if the end has been reached.BufferUnderflowExceptionpublic String parse8bit(@NotNull @NotNull StopCharTester stopCharTester) throws BufferUnderflowException
stopCharTester - to check if the end has been reached.BufferUnderflowExceptionpublic void parse8bit(Appendable buffer, @NotNull @NotNull StopCharsTester stopCharsTester) throws BufferUnderflowException
buffer - to populatestopCharsTester - to check if the end has been reached.BufferUnderflowExceptionpublic void parse8bit(Bytes buffer, @NotNull @NotNull StopCharsTester stopCharsTester) throws BufferUnderflowException
BufferUnderflowExceptionpublic void parse8bit(StringBuilder buffer, @NotNull @NotNull StopCharsTester stopCharsTester) throws BufferUnderflowException
BufferUnderflowExceptionpublic int parseInt()
throws BufferUnderflowException
BufferUnderflowExceptionpublic long parseLong()
throws BufferUnderflowException
BufferUnderflowExceptionpublic float parseFloat()
throws BufferUnderflowException
The number of decimal places can be retrieved with lastDecimalPlaces()
BufferUnderflowExceptionpublic double parseDouble()
throws BufferUnderflowException
The number of decimal places can be retrieved with lastDecimalPlaces()
BufferUnderflowExceptionpublic long parseLongDecimal()
throws BufferUnderflowException
The number of decimal places can be retrieved with lastDecimalPlaces()
BufferUnderflowExceptionpublic boolean skipTo(@NotNull
@NotNull StopCharTester tester)
tester - to stop at@NotNull public @NotNull BigDecimal parseBigDecimal()
public long readRemaining()
public long writeRemaining()
public long addressForRead(long offset,
int buffer)
throws UnsupportedOperationException,
BufferUnderflowException
public ByteOrder byteOrder()
public boolean compareAndSwapFloat(long offset,
float expected,
float value)
throws BufferOverflowException
offset - to perform CASexpected - valuevalue - to setBufferOverflowExceptionpublic boolean compareAndSwapDouble(long offset,
double expected,
double value)
throws BufferOverflowException
offset - to perform CASexpected - valuevalue - to setBufferOverflowExceptionCopyright © 2020. All rights reserved.