public class OnHeapBytes extends VanillaBytes<byte[]>
| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_CAPACITY |
bytesStore, DISABLE_THREAD_SAFETY, isPresent, readPosition, writeLimitreferenceCounted, WARN_COUNT, WARN_NSDEFAULT_BYTE_BUFFER_CAPACITY, MAX_HEAP_CAPACITYcharToStringJAVA9_STRING_CODER_LATIN, JAVA9_STRING_CODER_UTF16| Constructor and Description |
|---|
OnHeapBytes(@NotNull BytesStore<?,?> bytesStore,
boolean elastic)
Constructs an instance of OnHeapBytes using the provided BytesStore.
|
| Modifier and Type | Method and Description |
|---|---|
long |
capacity()
Provides the maximum limit that can be set for the ByteStore.
|
void |
ensureCapacity(long desiredCapacity)
Ensures that this Bytes object has the capacity to accommodate the specified amount of data.
|
boolean |
isElastic()
Checks if this Bytes object is elastic, meaning it can dynamically resize when more data is written
than its current
Bytes.realCapacity(). |
protected void |
writeCheckOffset(long offset,
long adding) |
append, append8bit, append8bit, append8bit, append8bit0, appendUtf8, appendUtf8, byteCheckSum, bytesForRead, bytesStore, compareTo, copy, equalBytes, findByte, isEqual, maxSize, offset, optimisedWrite, parseLong, read, read8Bit, readVolatileLong, realCapacity, toString, toString0, toTemporaryDirectByteBuffer, vanillaBytes, wrap, write, write, writeacquireUncheckedInput, addressForRead, addressForWrite, addressForWritePosition, append, append, append, append, append, append, appendAndReturnLength, byteCheckSum, byteCheckSum, bytesStore, bytesStore, canReadDirect, canWriteDirect, clear, clearAndPad, compact, compareAndSwapInt, compareAndSwapLong, copyTo, decimaliser, decimaliser, equals, fpAppend0, fpAppend0, hashCode, internalNumberBuffer, isDirectMemory, isImmutableEmptyByteStore, lastDecimalPlaces, lastDecimalPlaces, lastNumberHadDigits, lastNumberHadDigits, length, 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, readPositionForHeader, readShort, readShort, readSkip, readUnsignedByte, readUnsignedByte, readVolatileByte, readVolatileInt, readVolatileInt, readVolatileLong, readVolatileShort, safeCopySize, start, startsWith, testAndSetInt, uncheckedReadSkipBackOne, uncheckedReadSkipOne, uncheckedReadUnsignedByte, uncheckedWritePosition, underlyingObject, write, write, write, write, write, write, write8bit, write8bit, write8bit, write8bit, writeBoolean, writeByte, writeByte, 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, writeVolatileShortaddReferenceChangeListener, assertReferencesReleased, backgroundPerformRelease, canReleaseInBackground, clearUsedByThread, createdHere, disableReferenceTracing, enableReferenceTracing, refCount, referenceCountedUnmonitored, referenceId, release, releaseLast, removeReferenceChangeListener, reserve, reservedBy, reserveTransfer, singleThreadedCheckDisabled, singleThreadedCheckReset, threadSafetyCheck, throwExceptionIfNotReleased, throwExceptionIfReleased, tryReserve, unmonitor, warnAndReleaseIfNotReleasedclone, finalize, getClass, notify, notifyAll, wait, wait, waitaddress, bytesStore, lock, tryLockallocateDirect, allocateDirect, allocateElasticDirect, allocateElasticDirect, allocateElasticOnHeap, allocateElasticOnHeap, bytesForWrite, 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, writeMarshallableLength16addAndGetDouble, addAndGetDoubleNotAtomic, addAndGetFloat, addAndGetFloatNotAtomic, addAndGetInt, addAndGetIntNotAtomic, addAndGetLong, addAndGetShortNotAtomic, addAndGetUnsignedByteNotAtomic, charAt, cipher, cipher, compareAndSwapDouble, compareAndSwapFloat, contentEquals, elasticByteBuffer, endsWith, follow, forFields, from, hash, inside, inside, isEmpty, isEqual, lazyNativeBytesStoreWithFixedCapacity, nativePointer, nativeStore, nativeStoreFrom, nativeStoreWithFixedCapacity, startsWith, subSequence, to8bitString, toDebugString, toDebugString, wrap, wrap, wrap, writeMaxInt, writeMaxLong, zeroOutappend, append, write, write, writeBoolean, writeByte, writeInt24, writeOrderedDouble, writeOrderedFloat, writeUnsignedByte, writeUnsignedInt, writeUnsignedShort, writeUtf8, writeUtf8Limited, writeVolatileDouble, writeVolatileFloatchars, codePointsbytesMethodReader, bytesMethodReaderBuilder, readObjectcanReadDirect, compareUtf8, copyTo, createCharToString, fastHash, parseLong, peekVolatileInt, printable, readBoolean, readIncompleteLong, readUnsignedInt, readUnsignedInt24, readUnsignedShort, readUtf8, readUtf8Limited, readUtf8Limited, readVolatileDouble, readVolatileFloat, subBytes, toByteArrayparse8bit, parse8bit, parse8bit, parse8bit, parse8bit, parseBigDecimal, parseBoolean, parseBoolean, parseDouble, parseFlexibleLong, parseFloat, parseInt, parseLongDecimal, parseUtf8, parseUtf8, parseUtf8, reader, skipToinputStream, parseHexLong, parseUtf8, parseUtf8, rawReadByte, rawReadInt, rawReadLong, read, read, read, read, read8bit, read8bit, read8bit, readBigDecimal, readBigInteger, readBoolean, readChar, readEnum, readHistogram, readIncompleteLong, readInt24, readLimitToCapacity, readPositionRemaining, readPositionUnlimited, readStopBit, readStopBitChar, readStopBitDecimal, readStopBitDouble, readUnsignedInt, readUnsignedInt24, readUnsignedShort, readUtf8, readUtf8, readUtf8, readUtf8, readWithLength, readWithLength, readWithLength0, unsafeRead, unsafeReadObject, unsafeReadObjectbytesMethodWriter, writeObjectappend, append, append, append, append8bit, append8bit, appendBase, appendBase16, appendBase16, appendDateMillis, appendDecimal, appendTimeMillis, writerappendUtf8, appendUtf8, appendUtf8, appendUtf8, copyFrom, outputStream, rawWriteByte, rawWriteInt, rawWriteLong, unsafeWrite, unsafeWriteObject, unsafeWriteObject, write, write, write, write8bit, write8bit, write8bit, writeBigDecimal, writeBigInteger, writeChar, writeEnum, writeHistogram, writeInt24, writePositionForHeader, writePositionRemaining, writeSome, writeStopBit, writeStopBit, writeStopBit, writeStopBitDecimal, writeUnsignedByte, writeUnsignedInt, writeUnsignedInt24, writeUnsignedShort, writeUtf8, writeUtf8, writeWithLengthprependadjustHexDumpIndentation, retainedHexDumpDescription, writeHexDumpDescriptionpublic static final int MAX_CAPACITY
public OnHeapBytes(@NotNull
@NotNull BytesStore<?,?> bytesStore,
boolean elastic)
throws net.openhft.chronicle.core.io.ClosedIllegalStateException,
IllegalArgumentException,
net.openhft.chronicle.core.io.ThreadingIllegalStateException
OnHeapBytes allows for the manipulation of byte sequences in an on-heap manner, meaning it relies on JVM's garbage
collector for memory management. It can either have a fixed size (not elastic) or allow for dynamic resizing (elastic).
If the OnHeapBytes is set to be elastic, its maximum capacity is specified by MAX_CAPACITY, else it matches
the capacity of the provided BytesStore. In both elastic and non-elastic states, this instance can be read/written using cursors.
bytesStore - the BytesStore instance containing the bytes to be managed.elastic - a boolean value specifying whether this instance of OnHeapBytes is elastic.
If true, the instance is elastic and its capacity can grow up to MAX_CAPACITY.
If false, the instance has a fixed size that matches the capacity of the provided BytesStore.IllegalArgumentException - If the arguments provided are not valid, for instance if the BytesStore's
capacity exceeds the MAX_CAPACITY when the elastic parameter is false.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe waypublic long capacity()
BytesStorecapacity in interface BytesStore<Bytes<byte[]>,byte[]>capacity in class AbstractBytes<byte[]>public void ensureCapacity(long desiredCapacity)
throws IllegalArgumentException,
net.openhft.chronicle.core.io.ClosedIllegalStateException,
net.openhft.chronicle.core.io.ThreadingIllegalStateException
Bytes
If this Bytes object is elastic and doesn't have enough capacity, it will be resized. If it is not
elastic and doesn't have enough capacity, a DecoratedBufferOverflowException will be thrown.
desiredCapacity - The minimum capacity, in bytes, that is required.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayIllegalArgumentExceptionpublic boolean isElastic()
BytesBytes.realCapacity().
Elastic Bytes objects can automatically grow to accommodate additional data, whereas non-elastic ones have a fixed capacity.
isElastic in interface Bytes<byte[]>isElastic in class VanillaBytes<byte[]>true if this Bytes object is elastic; false otherwise.protected void writeCheckOffset(long offset,
long adding)
throws BufferOverflowException,
net.openhft.chronicle.core.io.ClosedIllegalStateException,
net.openhft.chronicle.core.io.ThreadingIllegalStateException
writeCheckOffset in class AbstractBytes<byte[]>BufferOverflowExceptionnet.openhft.chronicle.core.io.ClosedIllegalStateExceptionnet.openhft.chronicle.core.io.ThreadingIllegalStateExceptionCopyright © 2023. All rights reserved.