U
- Underlying typepublic class NativeBytes<U> extends VanillaBytes<U>
This class can wrap heap ByteBuffers, called NativeBytes for historical reasons.
bytesStore, DISABLE_THREAD_SAFETY, isPresent, readPosition, writeLimit, writePosition
referenceCounted, WARN_COUNT, WARN_NS
DEFAULT_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(@NotNull BytesStore<Bytes<U>,U> bytesStore) |
void |
bytesStore(@NotNull BytesStore<Bytes<U>,U> 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)
Grows the buffer if the buffer is elastic, if the buffer is not elastic and there is not
enough capacity then this method will throw an
DecoratedBufferOverflowException |
boolean |
isElastic()
Returns if this Bytes object is elastic.
|
boolean |
isEqual(long start,
long length,
String s)
Returns if a specified portion of this BytesStore is equal to a specified String.
|
protected static <T> long |
maxCapacityFor(@NotNull BytesStore<?,T> bs) |
static @NotNull NativeBytes<Void> |
nativeBytes() |
static @NotNull NativeBytes<Void> |
nativeBytes(long initialCapacity) |
long |
readRemaining()
Returns the remaining bytes that can be read.
|
static void |
resetNewGuarded()
For testing
|
static boolean |
setNewGuarded(boolean guarded)
turn guarding on/off.
|
static <T> @NotNull NativeBytes<T> |
wrapWithNativeBytes(@NotNull BytesStore<?,T> bs,
long capacity) |
@NotNull Bytes<U> |
writeByte(byte i8) |
protected void |
writeCheckOffset(long offset,
long adding) |
@NotNull Bytes<U> |
writeLong(long i64)
Write a long
|
protected long |
writeOffsetPositionMoved(long adding,
long advance) |
@NotNull NativeBytes |
writeSome(@NotNull Bytes<?> bytes)
Write all data available from bytes argument, constrained by how much space available in this.
|
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
acquireUncheckedInput, addressForRead, addressForWrite, addressForWritePosition, append, byteCheckSum, byteCheckSum, bytesStore, canReadDirect, canWriteDirect, clear, clearAndPad, compact, compareAndSwapInt, compareAndSwapLong, equals, hashCode, isDirectMemory, isImmutableEmptyByteStore, lastDecimalPlaces, lastDecimalPlaces, lastNumberHadDigits, lastNumberHadDigits, lenient, lenient, move, nativeRead, nativeWrite, peekUnsignedByte, peekUnsignedByte, performRelease, prewrite, prewrite, prewriteByte, prewriteInt, prewriteLong, prewriteOffsetPositionMoved, prewriteShort, read, read, readByte, readByte, readCheckOffset, readDouble, readDouble, readFloat, readFloat, readInt, readInt, readLimit, readLimit, readLong, readLong, readOffsetPositionMoved, readPosition, readPosition, readShort, readShort, readSkip, readUnsignedByte, readUnsignedByte, readVolatileByte, readVolatileInt, readVolatileInt, readVolatileLong, readVolatileShort, safeCopySize, start, startsWith, 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
addReferenceChangeListener, assertReferencesReleased, backgroundPerformRelease, canReleaseInBackground, clearUsedByThread, createdHere, disableReferenceTracing, enableReferenceTracing, refCount, referenceId, release, releaseLast, removeReferenceChangeListener, reserve, reservedBy, reserveTransfer, singleThreadedCheckDisabled, singleThreadedCheckReset, threadSafetyCheck, throwExceptionIfNotReleased, throwExceptionIfReleased, tryReserve, unmonitor, warnAndReleaseIfNotReleased
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
address, bytesStore, lock, tryLock
allocateDirect, allocateDirect, allocateElasticDirect, allocateElasticDirect, allocateElasticOnHeap, allocateElasticOnHeap, copyTo, copyTo, directFrom, elasticByteBuffer, elasticByteBuffer, elasticByteBuffer, elasticHeapByteBuffer, elasticHeapByteBuffer, empty, forFieldGroup, from, from, fromDirect, fromHexString, indexOf, indexOf, isClear, readMarshallableLength16, readWithLength, readWrite, safeLimit, sharedMemory, toHexString, toHexString, toHexString, toString, toString, toString, unchecked, unchecked, unwrite, valueOf, wrapForRead, wrapForRead, wrapForWrite, wrapForWrite, write, writeMarshallableLength16
addAndGetDouble, addAndGetDoubleNotAtomic, addAndGetFloat, addAndGetFloatNotAtomic, addAndGetInt, addAndGetIntNotAtomic, addAndGetLong, addAndGetShortNotAtomic, addAndGetUnsignedByteNotAtomic, bytesForWrite, charAt, cipher, cipher, compareAndSwapDouble, compareAndSwapFloat, contentEquals, elasticByteBuffer, endsWith, forFields, from, hash, inside, inside, isEmpty, lazyNativeBytesStoreWithFixedCapacity, length, nativePointer, nativeStore, nativeStoreFrom, nativeStoreWithFixedCapacity, 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
canReadDirect, compareUtf8, copyTo, copyTo, createCharToString, fastHash, findByte, parseLong, peekVolatileInt, printable, readBoolean, readIncompleteLong, readUnsignedInt, readUnsignedInt24, readUnsignedShort, readUtf8, readUtf8Limited, readUtf8Limited, readVolatileDouble, readVolatileFloat, subBytes, toByteArray
parse8bit, parse8bit, parse8bit, parse8bit, parse8bit, parseBigDecimal, parseBoolean, parseBoolean, parseDouble, parseFlexibleLong, parseFloat, parseInt, parseLong, parseLongDecimal, parseUtf8, parseUtf8, parseUtf8, reader, skipTo
inputStream, parseHexLong, parseUtf8, parseUtf8, rawReadByte, rawReadInt, rawReadLong, read, read, read, read, read8bit, read8bit, read8bit, readBigDecimal, readBigInteger, readBoolean, readChar, readEnum, readHistogram, readIncompleteLong, readInt24, readLimitToCapacity, readPositionForHeader, readPositionRemaining, readPositionUnlimited, readStopBit, readStopBitChar, readStopBitDecimal, readStopBitDouble, readUnsignedInt, readUnsignedInt24, readUnsignedShort, readUtf8, readUtf8, readUtf8, readUtf8, readWithLength, readWithLength, readWithLength0, unsafeRead, unsafeReadObject, unsafeReadObject
bytesMethodWriter, writeObject
append, append, append, append, append, append, append, append, append8bit, append8bit, appendBase, appendBase16, appendBase16, appendDateMillis, appendDecimal, appendTimeMillis, writer
appendUtf8, appendUtf8, appendUtf8, appendUtf8, copyFrom, outputStream, rawWriteByte, rawWriteInt, rawWriteLong, unsafeWrite, unsafeWriteObject, unsafeWriteObject, write, write, write, write, write8bit, write8bit, write8bit, writeBigDecimal, writeBigInteger, writeBoolean, writeChar, writeEnum, writeHistogram, writeInt24, writePositionForHeader, writePositionRemaining, writeStopBit, writeStopBit, writeStopBit, writeStopBitDecimal, writeUnsignedByte, writeUnsignedInt, writeUnsignedInt24, writeUnsignedShort, writeUtf8, writeUtf8, 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<U>,U>
capacity
in class AbstractBytes<U>
protected void writeCheckOffset(long offset, long adding) throws BufferOverflowException, IllegalStateException
writeCheckOffset
in class AbstractBytes<U>
BufferOverflowException
IllegalStateException
public void ensureCapacity(long desiredCapacity) throws IllegalArgumentException, IllegalStateException
Bytes
DecoratedBufferOverflowException
desiredCapacity
- the capacity that you requiredIllegalStateException
- if closed and it needs a resizeIllegalArgumentException
public boolean isElastic()
Bytes
Bytes.realCapacity()
.public boolean isEqual(long start, long length, String s)
BytesStore
start
- the portion offsetlength
- the number of bytes from this BytesStore that should be compared to ss
- the String to compare totrue
if the specified portion of this BytesStore is equal to sprotected void bytesStore(@NotNull @NotNull BytesStore<Bytes<U>,U> bytesStore)
bytesStore
in class AbstractBytes<U>
public void bytesStore(@NotNull @NotNull BytesStore<Bytes<U>,U> byteStore, long offset, long length) throws IllegalStateException, IllegalArgumentException, BufferUnderflowException
Byteable
bytesStore
in interface Byteable<Bytes<U>,U>
bytesStore
in class VanillaBytes<U>
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
StreamingDataOutput
Calling this method will update the cursors of this, but not the bytes we read from.
IllegalStateException
protected long writeOffsetPositionMoved(long adding, long advance) throws BufferOverflowException, IllegalStateException
writeOffsetPositionMoved
in class AbstractBytes<U>
BufferOverflowException
IllegalStateException
@NotNull public @NotNull Bytes<U> writeByte(byte i8) throws BufferOverflowException, IllegalStateException
writeByte
in interface StreamingDataOutput<Bytes<U>>
writeByte
in class AbstractBytes<U>
BufferOverflowException
IllegalStateException
@NotNull public @NotNull Bytes<U> writeLong(long i64) throws BufferOverflowException, IllegalStateException
StreamingDataOutput
writeLong
in interface StreamingDataOutput<Bytes<U>>
writeLong
in class AbstractBytes<U>
BufferOverflowException
IllegalStateException
public long readRemaining()
If the resource is closed, the returned value is unspecified.
Copyright © 2022. All rights reserved.