public class NativeBytes<Underlying> extends VanillaBytes<Underlying>
This class can wrap heap ByteBuffers, called NativeBytes for historical reasons.
Modifier and Type | Class and Description |
---|---|
static class |
NativeBytes.NativeSubBytes
Deprecated.
|
bytesStore, isPresent, readPosition, writeLimit, writePosition
referenceCounted, WARN_COUNT, WARN_NS
DEFAULT_BYTE_BUFFER_CAPACITY, MAX_BYTE_BUFFER_CAPACITY, MAX_CAPACITY, MAX_HEAP_CAPACITY
charToString
JAVA9_STRING_CODER_LATIN, JAVA9_STRING_CODER_UTF16
Constructor and Description |
---|
NativeBytes(@NotNull BytesStore store) |
NativeBytes(@NotNull BytesStore store,
long capacity) |
Modifier and Type | Method and Description |
---|---|
static boolean |
areNewGuarded()
For testing
|
protected void |
bytesStore(BytesStore<Bytes<Underlying>,Underlying> bytesStore) |
void |
bytesStore(@NotNull BytesStore<Bytes<Underlying>,Underlying> byteStore,
long offset,
long length)
This setter for a data type which points to an underlying ByteStore.
|
long |
capacity() |
static BytesStore<Bytes<Void>,Void> |
copyOf(@NotNull Bytes bytes) |
void |
ensureCapacity(long desiredCapacity)
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 |
boolean |
isElastic()
Returns if this Bytes is elastic.
|
boolean |
isEqual(long start,
long length,
String s) |
protected static <T> long |
maxCapacityFor(@NotNull BytesStore<?,T> bs) |
static @NotNull NativeBytes<Void> |
nativeBytes() |
static @NotNull NativeBytes<Void> |
nativeBytes(long initialCapacity) |
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.
|
default @NotNull Reader |
reader()
Access these bytes as an ISO-8859-1 encoded Reader
|
long |
readRemaining() |
static void |
resetNewGuarded()
For testing
|
static boolean |
setNewGuarded(boolean guarded)
turn guarding on/off.
|
default boolean |
skipTo(@NotNull StopCharTester tester)
Skip text until a terminating character is reached.
|
static <T> @NotNull NativeBytes<T> |
wrapWithNativeBytes(@NotNull BytesStore<?,T> bs,
long capacity) |
@NotNull Bytes<Underlying> |
writeByte(byte i8) |
protected void |
writeCheckOffset(long offset,
long adding) |
@NotNull Bytes<Underlying> |
writeLong(long i64)
Write a long
|
protected long |
writeOffsetPositionMoved(long adding,
long advance) |
@NotNull NativeBytes |
writeSome(@NotNull Bytes bytes) |
append, append8bit, append8bit, append8bit, append8bit0, appendUtf8, appendUtf8, byteCheckSum, bytesForRead, compareTo, copy, equalBytes, isEqual, maxSize, offset, optimisedWrite, read, read8Bit, readVolatileLong, realCapacity, toString, toString0, toTemporaryDirectByteBuffer, vanillaBytes, write, write, write
addressForRead, addressForWrite, addressForWritePosition, append, byteCheckSum, byteCheckSum, bytesStore, canReadDirect, canWriteDirect, clear, clearAndPad, compact, compareAndSwapInt, compareAndSwapLong, equals, hashCode, isDirectMemory, lastDecimalPlaces, lastDecimalPlaces, lenient, lenient, move, nativeRead, nativeWrite, peekUnsignedByte, peekUnsignedByte, performRelease, 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, safeCopySize, start, testAndSetInt, uncheckedReadSkipBackOne, uncheckedReadSkipOne, uncheckedReadUnsignedByte, uncheckedWritePosition, underlyingObject, write, write, write, write, write, write8bit, write8bit, write8bit, write8bit, writeByte, writeDouble, writeDouble, writeDoubleAndInt, writeFloat, writeFloat, writeInt, writeInt, writeIntAdv, writeLimit, writeLimit, writeLong, writeLongAdv, writeOffsetPositionMoved, writeOrderedInt, writeOrderedInt, writeOrderedLong, writeOrderedLong, writePosition, writePosition, writeShort, writeShort, writeSkip, writeSome, writeVolatileByte, writeVolatileInt, writeVolatileLong, writeVolatileShort
assertReferencesReleased, createdHere, disableReferenceTracing, enableReferenceTracing, performReleaseInBackground, refCount, referenceId, release, releaseLast, reserve, reservedBy, reserveTransfer, threadSafetyCheck, throwExceptionIfNotReleased, throwExceptionIfReleased, tryReserve, unmonitor, warnAndReleaseIfNotReleased
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
bytesStore
allocateDirect, allocateDirect, allocateElasticDirect, allocateElasticDirect, allocateElasticOnHeap, allocateElasticOnHeap, copyTo, copyTo, directFrom, elasticByteBuffer, elasticByteBuffer, elasticByteBuffer, elasticHeapByteBuffer, elasticHeapByteBuffer, forFieldGroup, from, from, fromDirect, fromHexString, fromString, indexOf, indexOf, indexOf, indexOf, isClear, readBigDecimal, readBigInteger, readMarshallableLength16, readWithLength, readWrite, safeLimit, sharedMemory, toHexString, toHexString, toHexString, toString, toString, toString, unchecked, unchecked, unwrite, valueOf, wrapForRead, wrapForRead, wrapForWrite, wrapForWrite, write, writeMarshallableLength16
addAndGetDoubleNotAtomic, addAndGetFloatNotAtomic, addAndGetIntNotAtomic, addAndGetShortNotAtomic, addAndGetUnsignedByteNotAtomic, bytesForWrite, charAt, cipher, cipher, contentEquals, empty, endsWith, from, hash, inside, inside, isEmpty, length, nativePointer, startsWith, startsWith, subSequence, to8bitString, toDebugString, toDebugString, wrap, wrap, wrap, writeMaxInt, writeMaxLong, zeroOut
append, append, write, write, writeBoolean, writeByte, writeInt24, writeOrderedDouble, writeOrderedFloat, writeUnsignedByte, writeUnsignedInt, writeUnsignedShort, writeUtf8, writeUtf8Limited, writeVolatileDouble, writeVolatileFloat
chars, codePoints
bytesMethodReader, bytesMethodReaderBuilder, readObject
addAndGetDouble, addAndGetFloat, addAndGetInt, addAndGetLong, compareUtf8, copyTo, copyTo, createCharToString, fastHash, findByte, parseLong, peekVolatileInt, printable, read, readBoolean, readIncompleteLong, readUnsignedInt, readUnsignedInt24, readUnsignedShort, readUtf8, readUtf8Limited, readUtf8Limited, readVolatileDouble, readVolatileFloat, subBytes, toByteArray
inputStream, parseHexLong, parseUTF, parseUtf8, parseUtf8, rawReadByte, rawReadInt, rawReadLong, read, read, read, read, read, read8bit, read8bit, read8bit, read8bit, readBoolean, readChar, readEnum, readHistogram, readIncompleteLong, readInt24, readLimitToCapacity, readPositionRemaining, readPositionUnlimited, readStopBit, readStopBitChar, readStopBitDecimal, readStopBitDouble, readUnsignedInt, readUnsignedInt24, readUnsignedShort, readUtf8, readUtf8, readUtf8, readUtf8, readUTFΔ, readUTFΔ, readWithLength, readWithLength, readWithLength0, unsafeReadObject, unsafeReadObject
bytesMethodWriter, writeObject
append, append, append, append, append, append, append, append, append8bit, append8bit, appendBase, appendBase16, appendBase16, appendDateMillis, appendDecimal, appendTimeMillis, writer
alignBy, appendUtf8, appendUtf8, appendUtf8, appendUtf8, copyFrom, outputStream, rawWriteByte, rawWriteInt, rawWriteLong, unsafeWriteObject, unsafeWriteObject, write, write, write, write, write8bit, write8bit, write8bit, writeBigDecimal, writeBigInteger, writeBoolean, writeChar, writeEnum, writeHistogram, writeInt24, writePositionRemaining, writeStopBit, writeStopBit, writeStopBit, writeStopBitDecimal, writeUnsignedByte, writeUnsignedInt, writeUnsignedInt24, writeUnsignedShort, writeUtf8, writeUtf8, writeUTFΔ, writeWithLength
prepend
comment, indent, retainsComments
public NativeBytes(@NotNull @NotNull BytesStore store, long capacity) throws IllegalStateException, IllegalArgumentException
public NativeBytes(@NotNull @NotNull BytesStore store) throws IllegalStateException, IllegalArgumentException
public static boolean areNewGuarded()
public static boolean setNewGuarded(boolean guarded)
assert NativeBytes.setNewGuarded(true);
guarded
- turn on if truepublic static void resetNewGuarded()
@NotNull public static @NotNull NativeBytes<Void> nativeBytes()
@NotNull public static @NotNull NativeBytes<Void> nativeBytes(long initialCapacity) throws IllegalArgumentException
IllegalArgumentException
public static BytesStore<Bytes<Void>,Void> copyOf(@NotNull @NotNull Bytes bytes) throws IllegalStateException
IllegalStateException
@NotNull public static <T> @NotNull NativeBytes<T> wrapWithNativeBytes(@NotNull @NotNull BytesStore<?,T> bs, long capacity) throws IllegalStateException, IllegalArgumentException
protected static <T> long maxCapacityFor(@NotNull @NotNull BytesStore<?,T> bs)
public long capacity()
capacity
in interface BytesStore<Bytes<Underlying>,Underlying>
capacity
in class AbstractBytes<Underlying>
protected void writeCheckOffset(long offset, long adding) throws BufferOverflowException, IllegalStateException
public void ensureCapacity(long desiredCapacity) throws IllegalArgumentException, IllegalStateException
Bytes
BufferOverflowException
desiredCapacity
- the capacity that you requiredIllegalArgumentException
- if the buffer is not elastic and there is not enough spaceIllegalStateException
public boolean isElastic()
Bytes
Bytes.realCapacity()
.isElastic
in interface Bytes<Underlying>
isElastic
in class VanillaBytes<Underlying>
public boolean isEqual(long start, long length, String s)
protected void bytesStore(BytesStore<Bytes<Underlying>,Underlying> bytesStore)
bytesStore
in class AbstractBytes<Underlying>
public void bytesStore(@NotNull @NotNull BytesStore<Bytes<Underlying>,Underlying> byteStore, long offset, long length) throws IllegalStateException, IllegalArgumentException, BufferUnderflowException
Byteable
bytesStore
in interface Byteable<Bytes<Underlying>,Underlying>
bytesStore
in class VanillaBytes<Underlying>
byteStore
- the fix point ByteStoreoffset
- the offset within the ByteStorelength
- the length in the ByteStoreIllegalStateException
IllegalArgumentException
BufferUnderflowException
@NotNull public @NotNull NativeBytes writeSome(@NotNull @NotNull Bytes bytes) throws IllegalStateException
IllegalStateException
protected long writeOffsetPositionMoved(long adding, long advance) throws BufferOverflowException, IllegalStateException
writeOffsetPositionMoved
in class AbstractBytes<Underlying>
BufferOverflowException
IllegalStateException
@NotNull public @NotNull Bytes<Underlying> writeByte(byte i8) throws BufferOverflowException, IllegalStateException
writeByte
in interface StreamingDataOutput<Bytes<Underlying>>
writeByte
in class AbstractBytes<Underlying>
BufferOverflowException
IllegalStateException
@NotNull public @NotNull Bytes<Underlying> writeLong(long i64) throws BufferOverflowException, IllegalStateException
StreamingDataOutput
writeLong
in interface StreamingDataOutput<Bytes<Underlying>>
writeLong
in class AbstractBytes<Underlying>
BufferOverflowException
IllegalStateException
public long readRemaining()
@NotNull public @NotNull Reader reader()
@Nullable public @Nullable Boolean parseBoolean(@NotNull @NotNull StopCharTester tester) throws BufferUnderflowException, IllegalStateException, ArithmeticException
false: f, false, n, no, 0
true: t, true, y, yes, 1
tester
- to detect the end of the text.BufferUnderflowException
IllegalStateException
ArithmeticException
@Nullable public @Nullable Boolean parseBoolean() throws BufferUnderflowException, IllegalStateException, ArithmeticException
@NotNull public @NotNull String parseUtf8(@NotNull @NotNull StopCharTester stopCharTester) throws IllegalStateException, ArithmeticException
stopCharTester
- to check if the end has been reached.IllegalStateException
ArithmeticException
@NotNull @Deprecated public @NotNull String parseUTF(@NotNull @NotNull StopCharTester stopCharTester) throws IllegalStateException, ArithmeticException
public void parseUtf8(@NotNull @NotNull Appendable buffer, @NotNull @NotNull StopCharTester stopCharTester) throws BufferUnderflowException, IllegalStateException, ArithmeticException
buffer
- to populatestopCharTester
- to check if the end has been reached.BufferUnderflowException
IllegalStateException
ArithmeticException
@Deprecated public void parseUTF(@NotNull @NotNull Appendable buffer, @NotNull @NotNull StopCharTester stopCharTester) throws BufferUnderflowException, IllegalStateException, ArithmeticException
public void parseUtf8(@NotNull @NotNull Appendable buffer, @NotNull @NotNull StopCharsTester stopCharsTester) throws BufferUnderflowException, net.openhft.chronicle.core.io.IORuntimeException, IllegalStateException
buffer
- to populatestopCharsTester
- to check if the end has been reached.BufferUnderflowException
net.openhft.chronicle.core.io.IORuntimeException
IllegalStateException
@Deprecated public void parseUTF(@NotNull @NotNull Appendable buffer, @NotNull @NotNull StopCharsTester stopCharsTester) throws BufferUnderflowException, net.openhft.chronicle.core.io.IORuntimeException, IllegalStateException
BufferUnderflowException
net.openhft.chronicle.core.io.IORuntimeException
IllegalStateException
public void parse8bit(Appendable buffer, @NotNull @NotNull StopCharTester stopCharTester) throws BufferUnderflowException, BufferOverflowException, IllegalStateException, ArithmeticException
buffer
- to populatestopCharTester
- to check if the end has been reached.BufferUnderflowException
BufferOverflowException
IllegalStateException
ArithmeticException
public String parse8bit(@NotNull @NotNull StopCharTester stopCharTester) throws BufferUnderflowException, IllegalStateException
stopCharTester
- to check if the end has been reached.BufferUnderflowException
IllegalStateException
public void parse8bit(Appendable buffer, @NotNull @NotNull StopCharsTester stopCharsTester) throws BufferUnderflowException, BufferOverflowException, IllegalStateException, ArithmeticException
buffer
- to populatestopCharsTester
- to check if the end has been reached.BufferUnderflowException
BufferOverflowException
IllegalStateException
ArithmeticException
public void parse8bit(Bytes buffer, @NotNull @NotNull StopCharsTester stopCharsTester) throws BufferUnderflowException, BufferOverflowException, IllegalStateException, ArithmeticException
public void parse8bit(StringBuilder buffer, @NotNull @NotNull StopCharsTester stopCharsTester) throws IllegalStateException
IllegalStateException
public int parseInt() throws BufferUnderflowException, ArithmeticException, IllegalStateException
BufferUnderflowException
ArithmeticException
IllegalStateException
public long parseLong() throws BufferUnderflowException, IllegalStateException
BufferUnderflowException
IllegalStateException
public float parseFloat() throws BufferUnderflowException, IllegalStateException
The number of decimal places can be retrieved with lastDecimalPlaces()
BufferUnderflowException
IllegalStateException
public double parseDouble() throws BufferUnderflowException, IllegalStateException
The number of decimal places can be retrieved with lastDecimalPlaces()
BufferUnderflowException
IllegalStateException
public long parseLongDecimal() throws BufferUnderflowException, IllegalStateException
The number of decimal places can be retrieved with lastDecimalPlaces()
BufferUnderflowException
IllegalStateException
public boolean skipTo(@NotNull @NotNull StopCharTester tester) throws IllegalStateException
tester
- to stop atIllegalStateException
@NotNull public @NotNull BigDecimal parseBigDecimal() throws IllegalStateException, ArithmeticException
Copyright © 2021. All rights reserved.