public class NativeBytes<Underlying> extends VanillaBytes<Underlying>
This class can wrap heap ByteBuffers, called NativeBytes for historical reasons.
bytesStore, isPresent, readPosition, writeLimit, writePosition
DEFAULT_BYTE_BUFFER_CAPACITY, MAX_BYTE_BUFFER_CAPACITY, MAX_CAPACITY
charToString
JAVA9_STRING_CODER_LATIN, JAVA9_STRING_CODER_UTF16
Modifier and Type | Method and Description |
---|---|
long |
capacity() |
static BytesStore<Bytes<Void>,Void> |
copyOf(Bytes bytes) |
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 |
boolean |
isElastic() |
static NativeBytes<Void> |
nativeBytes() |
static NativeBytes<Void> |
nativeBytes(long initialCapacity) |
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 BigDecimal |
parseBigDecimal() |
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 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 Reader |
reader()
Access these bytes as an ISO-8859-1 encoded Reader
|
default boolean |
skipTo(StopCharTester tester)
Skip text until a terminating character is reached.
|
Bytes<Underlying> |
write(byte[] bytes,
int offset,
int length)
Write all data or fail.
|
Bytes<Underlying> |
write(BytesStore bytes,
long offset,
long length)
Write all data or fail.
|
Bytes<Underlying> |
write8bit(BytesStore bs) |
Bytes<Underlying> |
writeByte(byte i8) |
protected void |
writeCheckOffset(long offset,
long adding) |
protected long |
writeOffsetPositionMoved(long adding,
long advance) |
NativeBytes |
writeSome(Bytes bytes) |
append, append8bit, append8bit, append8bit0, appendUtf8, appendUtf8, byteCheckSum, bytesForRead, bytesStore, copy, equalBytes, isEqual, maxSize, offset, read, read8Bit, readVolatileLong, realCapacity, toString, toString0, toTemporaryDirectByteBuffer, vanillaBytes, write
addressForRead, addressForWrite, bytesStore, clear, clearAndPad, compact, compareAndSwapInt, compareAndSwapLong, equals, equalsBytes, hashCode, isDirectMemory, isPresent, isPresent, lastDecimalPlaces, lastDecimalPlaces, 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, readVolatileByte, readVolatileInt, readVolatileInt, readVolatileLong, readVolatileShort, refCount, release, reserve, start, uncheckedReadSkipBackOne, uncheckedReadSkipOne, uncheckedReadUnsignedByte, underlyingObject, write, write, write, writeByte, writeCheckOffset0, writeDouble, writeDouble, writeFloat, writeFloat, writeInt, writeInt, writeIntAdv, writeLimit, writeLimit, writeLong, writeLong, writeLongAdv, writeOffsetPositionMoved, writeOrderedInt, writeOrderedInt, writeOrderedLong, writeOrderedLong, writePosition, writePosition, writeShort, writeShort, writeSkip, writeSome, writeVolatileByte, writeVolatileInt, writeVolatileLong, writeVolatileShort
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
bytesStore
allocateDirect, allocateDirect, allocateElasticDirect, allocateElasticDirect, copyTo, copyTo, elasticByteBuffer, elasticByteBuffer, elasticByteBuffer, elasticHeapByteBuffer, from, fromHexString, fromString, indexOf, indexOf, indexOf, indexOf, isClear, readBigDecimal, readBigInteger, readWithLength, readWrite, safeLimit, sharedMemory, toHexString, toHexString, toHexString, toString, toString, toString, unchecked, unchecked, unwrite, wrapForRead, wrapForRead, wrapForWrite, wrapForWrite
addAndGetByteNotAtomic, addAndGetDoubleNotAtomic, addAndGetFloatNotAtomic, addAndGetIntNotAtomic, addAndGetLongNotAtomic, addAndGetShortNotAtomic, addAndGetUnsignedByteNotAtomic, addAndGetUnsignedIntNotAtomic, addAndGetUnsignedShortNotAtomic, bytesForWrite, charAt, cipher, cipher, contentEquals, empty, endsWith, inside, isEmpty, length, longCheckSum, nativePointer, startsWith, startsWith, subSequence, to8bitString, toDebugString, toDebugString, wrap, wrap, wrap, writeMaxLong, zeroOut
addAndGetDouble, addAndGetFloat, addAndGetInt, addAndGetLong, compareUtf8, copyTo, copyTo, createCharToString, fastHash, findByte, parseLong, peekVolatileInt, printable, read, readBoolean, readIncompleteLong, readUnsignedByte, readUnsignedInt, readUnsignedInt24, readUnsignedShort, readUtf8, readUtf8Limited, readUtf8Limited, readVolatileDouble, readVolatileFloat, subBytes, toByteArray
append, append, write, write, writeBoolean, writeByte, writeInt24, writeOrderedDouble, writeOrderedFloat, writeUnsignedByte, writeUnsignedInt, writeUnsignedShort, writeUtf8, writeUtf8Limited, writeVolatileDouble, writeVolatileFloat
chars, codePoints
bytesMethodReader, bytesMethodReaderBuilder
inputStream, parseHexLong, parseUTF, parseUtf8, read, read, read, read, read8bit, read8bit, read8bit, read8bit, readBoolean, readEnum, readHistogram, readPositionRemaining, readPositionUnlimited, readStopBit, readStopBitDecimal, readStopBitDouble, readUnsignedInt, readUnsignedInt24, readUnsignedShort, readUtf8, readUtf8, readUTFΔ, readUTFΔ, readWithLength, readWithLength, readWithLength0
bytesMethodWriter, bytesMethodWriterBuilder
append, append, append, append, append, append, append, append8bit, appendBase, appendBase16, appendDateMillis, appendDecimal, appendTimeMillis, writer
appendUtf8, appendUtf8, appendUtf8, appendUtf8, copyFrom, outputStream, write, write, write, write, write8bit, write8bit, write8bit, writeBigDecimal, writeBigInteger, writeBoolean, writeEnum, writeHistogram, writeInt24, writePositionRemaining, writeStopBit, writeStopBit, writeStopBitDecimal, writeUnsignedByte, writeUnsignedInt, writeUnsignedShort, writeUtf8, writeUtf8, writeUTFΔ, writeWithLength
prepend
comment, indent, retainsComments
@NotNull public static NativeBytes<Void> nativeBytes()
@NotNull public static NativeBytes<Void> nativeBytes(long initialCapacity) throws IllegalArgumentException
IllegalArgumentException
public static BytesStore<Bytes<Void>,Void> copyOf(@NotNull Bytes bytes)
public long capacity()
capacity
in interface BytesStore<Bytes<Underlying>,Underlying>
capacity
in class AbstractBytes<Underlying>
protected void writeCheckOffset(long offset, long adding) throws BufferOverflowException
BufferOverflowException
public void ensureCapacity(long size) throws IllegalArgumentException
Bytes
BufferOverflowException
size
- the capacity that you requiredIllegalArgumentException
- if the buffer is not elastic and there is not enough spacepublic boolean isElastic()
isElastic
in interface Bytes<Underlying>
isElastic
in class VanillaBytes<Underlying>
@NotNull public Bytes<Underlying> write(byte[] bytes, int offset, int length) throws BufferOverflowException, IllegalArgumentException
StreamingDataOutput
write
in interface StreamingDataOutput<Bytes<Underlying>>
write
in class AbstractBytes<Underlying>
BufferOverflowException
IllegalArgumentException
@NotNull public Bytes<Underlying> write(BytesStore bytes, long offset, long length) throws BufferOverflowException, IllegalArgumentException, BufferUnderflowException
StreamingDataOutput
write
in interface StreamingDataOutput<Bytes<Underlying>>
write
in class VanillaBytes<Underlying>
BufferOverflowException
IllegalArgumentException
BufferUnderflowException
@NotNull public NativeBytes writeSome(@NotNull Bytes bytes)
protected long writeOffsetPositionMoved(long adding, long advance) throws BufferOverflowException
writeOffsetPositionMoved
in class AbstractBytes<Underlying>
BufferOverflowException
@NotNull public Bytes<Underlying> writeByte(byte i8) throws BufferOverflowException
writeByte
in interface StreamingDataOutput<Bytes<Underlying>>
writeByte
in class AbstractBytes<Underlying>
BufferOverflowException
@NotNull public Bytes<Underlying> write8bit(@Nullable BytesStore bs) throws BufferOverflowException
BufferOverflowException
@NotNull public Reader reader()
@Nullable public 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.@NotNull public String parseUtf8(@NotNull StopCharTester stopCharTester)
stopCharTester
- to check if the end has been reached.@NotNull @Deprecated public String parseUTF(@NotNull StopCharTester stopCharTester)
public void parseUtf8(@NotNull Appendable buffer, @NotNull StopCharTester stopCharTester) throws BufferUnderflowException
buffer
- to populatestopCharTester
- to check if the end has been reached.BufferUnderflowException
@Deprecated public void parseUTF(@NotNull Appendable buffer, @NotNull StopCharTester stopCharTester) throws BufferUnderflowException
BufferUnderflowException
public 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 public void parseUTF(@NotNull Appendable buffer, @NotNull StopCharsTester stopCharsTester) throws BufferUnderflowException, net.openhft.chronicle.core.io.IORuntimeException
BufferUnderflowException
net.openhft.chronicle.core.io.IORuntimeException
public void parse8bit(Appendable buffer, @NotNull StopCharTester stopCharTester) throws BufferUnderflowException
buffer
- to populatestopCharTester
- to check if the end has been reached.BufferUnderflowException
public void parse8bit(Appendable buffer, @NotNull StopCharsTester stopCharsTester) throws BufferUnderflowException
buffer
- to populatestopCharsTester
- to check if the end has been reached.BufferUnderflowException
public long parseLong() throws BufferUnderflowException
BufferUnderflowException
public double parseDouble() throws BufferUnderflowException
The number of decimal places can be retrieved with lastDecimalPlaces()
BufferUnderflowException
public long parseLongDecimal() throws BufferUnderflowException
The number of decimal places can be retrieved with lastDecimalPlaces()
BufferUnderflowException
public boolean skipTo(@NotNull StopCharTester tester)
tester
- to stop at@NotNull public BigDecimal parseBigDecimal()
Copyright © 2018. All rights reserved.