U - The type of the object this Bytes can point to.public class UncheckedNativeBytes<U> extends net.openhft.chronicle.core.io.AbstractReferenceCounted implements Bytes<U>, HasUncheckedRandomDataInput, DecimalAppender
This class is intended for use in performance-critical scenarios where the client can ensure that all operations stay within valid bounds, thus avoiding the overhead of bounds checking.
Warning: Using this class improperly can result in IndexOutOfBoundsException being thrown, corruption of data, JVM crashes, or other undefined behavior.
| Modifier and Type | Field and Description |
|---|---|
protected @NotNull BytesStore<?,U> |
bytesStore |
protected long |
capacity |
protected long |
readPosition |
protected long |
writeLimit |
protected long |
writePosition |
referenceCounted, WARN_COUNT, WARN_NSDEFAULT_BYTE_BUFFER_CAPACITY, MAX_CAPACITY, MAX_HEAP_CAPACITYcharToStringJAVA9_STRING_CODER_LATIN, JAVA9_STRING_CODER_UTF16| Constructor and Description |
|---|
UncheckedNativeBytes(@NotNull Bytes<U> underlyingBytes)
Constructs an UncheckedNativeBytes instance by wrapping around the provided Bytes object.
|
| Modifier and Type | Method and Description |
|---|---|
@NotNull UncheckedRandomDataInput |
acquireUncheckedInput()
Returns a view of a memory segment providing memory read operations with potentially unchecked
memory boundaries.
|
long |
addressForRead(long offset)
Retrieves the underlying memory address for reading.
|
long |
addressForWrite(long offset)
Retrieves the underlying memory address for writing.
|
long |
addressForWritePosition()
Retrieves the underlying memory address for writing at the current write position.
|
void |
append(boolean negative,
long mantissa,
int exponent)
Appends a decimal number, represented by its sign, mantissa, and exponent, to a target.
|
@NotNull UncheckedNativeBytes<U> |
append(double d)
Appends a double in decimal notation
|
@NotNull UncheckedNativeBytes<U> |
append(float f)
Appends a float in decimal notation
|
@NotNull Bytes<U> |
append(int value)
Appends an int in decimal to this.
|
@NotNull Bytes<U> |
append(long value)
Appends a long value in decimal.
|
@NotNull Bytes<U> |
append8bit(@NotNull CharSequence cs)
Appends a String to the Bytes in ISO-8859-1.
|
long |
appendAndReturnLength(long writePosition,
boolean negative,
long mantissa,
int exponent,
boolean append0) |
@NotNull Bytes<U> |
appendUtf8(char[] chars,
int offset,
int length)
Appends a UTF-8 encoded CharSequence to this output stream from a specific offset and length.
|
int |
byteCheckSum()
Returns the bytes sum of the readable bytes in this BytesStore.
|
@Nullable BytesStore |
bytesStore()
Returns the backing BytesStore that this Bytes object wraps.
|
long |
capacity()
Provides the maximum limit that can be set for the ByteStore.
|
@NotNull Bytes<U> |
clear()
Clears the content of this Bytes object and resets its state.
|
@NotNull Bytes<U> |
clearAndPad(long length)
Clears the buffer and pads it with a specified length to allow prepending later.
|
@NotNull Bytes<U> |
compact()
Compacts this Bytes object by moving the readPosition() to the start(),
adjusting the readLimit()/writePosition() appropriately so that the readRemaining() is unchanged.
|
boolean |
compareAndSwapInt(long offset,
int expected,
int value)
Perform a 32-bit CAS at a given offset.
|
boolean |
compareAndSwapLong(long offset,
long expected,
long value)
Perform a 64-bit CAS at a given offset.
|
@NotNull BytesStore<Bytes<U>,U> |
copy()
Creates and returns a deep copy of this Bytes object, including the data between
RandomCommon.readPosition() and RandomCommon.readLimit(). |
Decimaliser |
decimaliser()
Gets the Decimaliser currently associated with this ByteStringAppender.
|
Bytes<U> |
decimaliser(Decimaliser decimaliser)
Associates a Decimaliser with this ByteStringAppender.
|
void |
ensureCapacity(long desiredCapacity)
Ensures that this Bytes object has the capacity to accommodate the specified amount of data.
|
boolean |
equals(Object obj) |
boolean |
fpAppend0() |
Bytes<U> |
fpAppend0(boolean append0) |
int |
hashCode() |
byte[] |
internalNumberBuffer()
Deprecated.
|
boolean |
isDirectMemory()
Checks if this BytesStore uses direct memory.
|
boolean |
isElastic()
Checks if this Bytes object is elastic, meaning it can dynamically resize when more data is written
than its current
Bytes.realCapacity(). |
int |
lastDecimalPlaces()
Returns the number of decimal places in the last parsed floating-point number
(from the
ByteStringParser.parseDouble() or ByteStringParser.parseLongDecimal() methods). |
void |
lastDecimalPlaces(int lastDecimalPlaces)
Sets the number of decimal places in the last parsed number.
|
boolean |
lastNumberHadDigits()
Returns whether the last parsed number had any digits.
|
void |
lastNumberHadDigits(boolean lastNumberHadDigits)
Sets whether the last parsed number had any digits.
|
boolean |
lenient() |
void |
lenient(boolean lenient)
When there is no more data to read, return zero,
false and empty string. |
void |
move(long from,
long to,
long length)
Moves a sequence of bytes within this BytesStore from the source to destination index.
|
void |
nativeRead(long position,
long address,
long size)
Expert-level method for transferring data from this byte source to native memory.
|
void |
nativeWrite(long address,
long position,
long size)
Expert-level method that copies data directly from native memory into this BytesStore.
|
int |
peekUnsignedByte()
Peeks (reads without moving the read pointer) the next unsigned byte from the input stream.
|
int |
peekUnsignedByte(long offset)
Reads an unsigned byte value from a specific offset.
|
protected void |
performRelease() |
@NotNull Bytes<U> |
prewrite(@NotNull byte[] bytes)
Writes a byte array backward in binary format.
|
@NotNull Bytes<U> |
prewrite(@NotNull BytesStore bytes)
Writes a BytesStore instance backward in binary format.
|
@NotNull Bytes<U> |
prewriteByte(byte i8)
Writes a byte backward in binary format.
|
@NotNull Bytes<U> |
prewriteInt(int i)
Writes an int (4-byte int) backward in binary format.
|
@NotNull Bytes<U> |
prewriteLong(long i64)
Writes a long (8-byte int) backward in binary format.
|
protected long |
prewriteOffsetPositionMoved(long substracting) |
@NotNull Bytes<U> |
prewriteShort(short i16)
Writes a short (2-byte int) backward in binary format.
|
long |
rawCopy(@NotNull RandomDataInput bytes,
long offset,
long length) |
Bytes<U> |
rawWriteByte(byte i8)
Writes a byte to the data stream without any additional checks or transformations.
|
byte |
readByte()
Reads a byte value from the input stream.
|
byte |
readByte(long offset)
Reads a byte value from a specific offset.
|
double |
readDouble()
Reads a 64-bit floating-point number from the input stream.
|
double |
readDouble(long offset)
Reads a 64-bit floating point value from a specified offset.
|
float |
readFloat()
Reads a 32-bit floating-point number from the input stream.
|
float |
readFloat(long offset)
Reads a 32-bit floating point value from a specified offset.
|
int |
readInt()
Reads a 32-bit integer value from the input stream.
|
int |
readInt(long offset)
Reads a 32-bit integer value from a specific offset.
|
long |
readLimit()
If the resource is closed, the returned value is unspecified.
|
@NotNull Bytes<U> |
readLimit(long limit)
Sets the read limit of this StreamingDataInput.
|
long |
readLong()
Reads a 64-bit long value from the input stream.
|
long |
readLong(long offset)
Reads a 64-bit long value from a specific offset.
|
protected long |
readOffsetPositionMoved(long adding) |
long |
readPosition()
Returns the read position.
|
@NotNull Bytes<U> |
readPosition(long position)
Sets the read position of this StreamingDataInput.
|
short |
readShort()
Reads a 16-bit short value from the input stream.
|
short |
readShort(long offset)
Reads a short value from a specific offset.
|
@NotNull Bytes<U> |
readSkip(long bytesToSkip)
Skips the specified number of bytes by advancing the read position.
|
int |
readUnsignedByte()
Reads the next unsigned 8-bit value from the input stream.
|
int |
readUnsignedByte(long offset)
Reads an unsigned byte value from a specific offset.
|
byte |
readVolatileByte(long offset)
Reads a volatile 8-bit byte value from a specified offset.
|
int |
readVolatileInt()
Reads a volatile (concurrently mutable) integer value from the input stream.
|
int |
readVolatileInt(long offset)
Reads a volatile 32-bit integer value from a specified offset.
|
long |
readVolatileLong()
Reads a volatile (concurrently mutable) long value from the input stream.
|
long |
readVolatileLong(long offset)
Reads a volatile 64-bit long value from a specified offset.
|
short |
readVolatileShort(long offset)
Reads a volatile 16-bit short value from a specified offset.
|
long |
realCapacity()
Returns the actual capacity of the ByteStore before any resizing occurs.
|
long |
realWriteRemaining()
Calculates the number of bytes remaining that can be written from the current write position with resizing.
|
void |
testAndSetInt(long offset,
int expected,
int value)
Tests if the current value at the specified offset equals the expected value and, if so, sets it to the provided value.
|
@NotNull String |
toString() |
boolean |
unchecked()
Checks whether this Bytes object operates in an unchecked mode.
|
@NotNull Bytes<U> |
unchecked(boolean unchecked)
Creates and returns a new Bytes which is optionally unchecked as indicated by the provided
unchecked. |
void |
uncheckedReadSkipBackOne()
Unchecked version of readSkip(-1).
|
void |
uncheckedReadSkipOne()
Unchecked version of readSkip(1).
|
int |
uncheckedReadUnsignedByte()
Reads the next unsigned 8-bit value from the input stream without performing boundary checks.
|
U |
underlyingObject() |
@NotNull Bytes<U> |
write(byte[] byteArray,
int offset,
int length)
Writes the specified number of bytes from the given
byteArray into the output stream, starting from the
given offset. |
@NotNull Bytes<U> |
write(long offsetInRDO,
byte[] byteArray,
int offset,
int length)
Copies the provided
byteArray to this Bytes object starting at writeOffset taking
content starting at readOffset but copying at most length bytes. |
void |
write(long offsetInRDO,
@NotNull ByteBuffer bytes,
int offset,
int length)
Copies a segment from the provided ByteBuffer into this data output.
|
@NotNull Bytes<U> |
write(long writeOffset,
@NotNull RandomDataInput bytes,
long readOffset,
long length)
Copies a segment from the provided RandomDataInput into this data output.
|
@NotNull Bytes<U> |
write(@NotNull RandomDataInput bytes)
Writes all available data from the specified
RandomDataInput into the output stream. |
@NotNull Bytes<U> |
write(@NotNull RandomDataInput bytes,
long offset,
long length)
Writes the specified number of bytes from the provided
RandomDataInput object into the output stream,
starting from the given read offset. |
Bytes<U> |
write8bit(@Nullable BytesStore bs) |
long |
write8bit(long position,
@NotNull BytesStore bs)
Writes a BytesStore instance to this RandomDataOutput at the given position.
|
long |
write8bit(long position,
@NotNull String s,
int start,
int length)
Writes a portion of a string to this RandomDataOutput at the given position.
|
@NotNull Bytes<U> |
write8bit(@NotNull String text,
int start,
int length)
Writes a subsequence of a String as an 8-bit string to the data stream.
|
@NotNull Bytes<U> |
writeByte(byte i8)
Writes a byte to the data stream.
|
@NotNull Bytes<U> |
writeByte(long offset,
byte i)
Writes a byte at the specified non-negative offset.
|
@NotNull Bytes<U> |
writeDouble(double d)
Writes a double-precision floating-point number to the data stream.
|
@NotNull Bytes<U> |
writeDouble(long offset,
double d)
Writes a double-precision floating-point value at the specified non-negative offset.
|
@NotNull Bytes<U> |
writeDoubleAndInt(double d,
int i)
Writes a double-precision floating-point number followed by an integer to the data stream.
|
@NotNull Bytes<U> |
writeFloat(float f)
Writes a floating-point number to the data stream.
|
@NotNull Bytes<U> |
writeFloat(long offset,
float d)
Writes a single-precision floating-point value at the specified non-negative offset.
|
@NotNull Bytes<U> |
writeInt(int i)
Writes an integer to the data stream.
|
@NotNull Bytes<U> |
writeInt(long offset,
int i)
Writes an integer value at the specified non-negative offset.
|
@NotNull Bytes<U> |
writeIntAdv(int i,
int advance)
Writes an integer to the data stream, then advances the write position by the specified amount.
|
long |
writeLimit()
Retrieves the maximum writable position within the buffer.
|
@NotNull Bytes<U> |
writeLimit(long limit)
Sets the limit for writing to the data stream.
|
@NotNull Bytes<U> |
writeLong(long i64)
Writes a long integer to the data stream.
|
@NotNull Bytes<U> |
writeLong(long offset,
long i)
Writes a long integer value at the specified non-negative offset.
|
@NotNull Bytes<U> |
writeLongAdv(long i64,
int advance)
Writes a long integer to the data stream, then advances the write position by the specified amount.
|
protected long |
writeOffsetPositionMoved(long adding) |
protected long |
writeOffsetPositionMoved(long adding,
long advance) |
@NotNull Bytes<U> |
writeOrderedInt(int i)
Writes an integer value to this output stream using an ordered-writing mechanism.
|
@NotNull Bytes<U> |
writeOrderedInt(long offset,
int i)
Performs a non-blocking write operation with a memory barrier to ensure order of stores.
|
@NotNull Bytes<U> |
writeOrderedLong(long i)
Writes a long value to this output stream using an ordered-writing mechanism.
|
@NotNull Bytes<U> |
writeOrderedLong(long offset,
long i)
Performs a non-blocking write operation with a memory barrier to ensure order of stores.
|
long |
writePosition()
Returns the write position.
|
@NotNull Bytes<U> |
writePosition(long position)
Sets the current write position in the data stream.
|
@NotNull Bytes<U> |
writeShort(long offset,
short i)
Writes a short integer at the specified non-negative offset.
|
@NotNull Bytes<U> |
writeShort(short i16)
Writes a short integer to the data stream.
|
@NotNull Bytes<U> |
writeSkip(long bytesToSkip)
Skips a specified number of bytes from the current write position in the data stream.
|
@NotNull Bytes<U> |
writeSome(@NotNull ByteBuffer buffer)
Writes the available data from the provided
ByteBuffer into this Bytes object. |
@NotNull Bytes<U> |
writeVolatileByte(long offset,
byte i8)
Writes a volatile byte at the specified non-negative offset.
|
@NotNull Bytes<U> |
writeVolatileInt(long offset,
int i32)
Writes a volatile integer at the specified non-negative offset.
|
@NotNull Bytes<U> |
writeVolatileLong(long offset,
long i64)
Writes a volatile long integer at the specified non-negative offset.
|
@NotNull Bytes<U> |
writeVolatileShort(long offset,
short i16)
Writes a volatile short at the specified non-negative offset.
|
addReferenceChangeListener, 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, waitallocateDirect, allocateDirect, allocateElasticDirect, allocateElasticDirect, allocateElasticOnHeap, allocateElasticOnHeap, bytesForRead, bytesForWrite, copyTo, copyTo, directFrom, elasticByteBuffer, elasticByteBuffer, elasticByteBuffer, elasticHeapByteBuffer, elasticHeapByteBuffer, empty, forFieldGroup, from, from, fromDirect, fromHexString, indexOf, indexOf, isClear, isEqual, readMarshallableLength16, readWithLength, readWrite, safeLimit, sharedMemory, toHexString, toHexString, toHexString, toString, toString, toString, unwrite, valueOf, wrapForRead, wrapForRead, wrapForWrite, wrapForWrite, write, writeMarshallableLength16addAndGetDouble, addAndGetDoubleNotAtomic, addAndGetFloat, addAndGetFloatNotAtomic, addAndGetInt, addAndGetIntNotAtomic, addAndGetLong, addAndGetShortNotAtomic, addAndGetUnsignedByteNotAtomic, byteCheckSum, charAt, cipher, cipher, compareAndSwapDouble, compareAndSwapFloat, contentEquals, elasticByteBuffer, endsWith, equalBytes, follow, forFields, from, hash, inside, inside, isEmpty, isEqual, isImmutableEmptyByteStore, lazyNativeBytesStoreWithFixedCapacity, length, nativePointer, nativeStore, nativeStoreFrom, nativeStoreWithFixedCapacity, startsWith, 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, canReadDirect, compareUtf8, copyTo, copyTo, createCharToString, fastHash, findByte, parseLong, peekVolatileInt, printable, read, readBoolean, readIncompleteLong, readUnsignedInt, readUnsignedInt24, readUnsignedShort, readUtf8, readUtf8Limited, readUtf8Limited, readVolatileDouble, readVolatileFloat, subBytes, toByteArray, toTemporaryDirectByteBufferparse8bit, parse8bit, parse8bit, parse8bit, parse8bit, parseBigDecimal, parseBoolean, parseBoolean, parseDouble, parseFlexibleLong, parseFloat, parseInt, parseLong, parseLongDecimal, parseUtf8, parseUtf8, parseUtf8, reader, skipToinputStream, parseHexLong, parseUtf8, parseUtf8, rawReadByte, rawReadInt, rawReadLong, read, read, 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, unsafeReadObjectbytesMethodWriter, writeObjectappend, append, append, append, append, append, append8bit, append8bit, append8bit, append8bit, appendBase, appendBase16, appendBase16, appendDateMillis, appendDecimal, appendTimeMillis, writerappendUtf8, appendUtf8, appendUtf8, appendUtf8, appendUtf8, canWriteDirect, copyFrom, outputStream, rawWriteInt, rawWriteLong, unsafeWrite, unsafeWriteObject, unsafeWriteObject, write, write, write, write, write, write8bit, write8bit, write8bit, writeBigDecimal, writeBigInteger, writeBoolean, writeChar, writeEnum, writeHistogram, writeInt24, writePositionForHeader, writePositionRemaining, writeSome, writeStopBit, writeStopBit, writeStopBit, writeStopBitDecimal, writeUnsignedByte, writeUnsignedInt, writeUnsignedInt24, writeUnsignedShort, writeUtf8, writeUtf8, writeWithLengthprependadjustHexDumpIndentation, retainedHexDumpDescription, writeHexDumpDescriptionprotected final long capacity
@NotNull protected @NotNull BytesStore<?,U> bytesStore
protected long readPosition
protected long writePosition
protected long writeLimit
public UncheckedNativeBytes(@NotNull
@NotNull Bytes<U> underlyingBytes)
throws IllegalStateException
underlyingBytes - the Bytes object to wrap aroundnet.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 wayIllegalStateExceptionpublic void ensureCapacity(long desiredCapacity)
throws IllegalArgumentException,
IllegalStateException
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.
ensureCapacity in interface Bytes<U>ensureCapacity in interface StreamingDataOutput<Bytes<U>>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 wayIllegalArgumentExceptionIllegalStateExceptionpublic boolean unchecked()
BytesWhen a Bytes object is unchecked, it performs minimal or no bounds checking on read and write operations. This can improve performance but may result in undefined behavior if attempting to access out-of-bounds elements.
public boolean isDirectMemory()
BytesStoreisDirectMemory in interface BytesStore<Bytes<U>,U>@NotNull public @NotNull Bytes<U> unchecked(boolean unchecked)
Bytesunchecked.
This allows bounds checks to be turned off.
Note: this means that the result is no longer elastic, even if this is elastic.
Note: It is only possible to go from a checked Bytes to an unchecked bytes and not vice versa.
public void move(long from,
long to,
long length)
throws IllegalStateException,
BufferUnderflowException
BytesStoremove in interface BytesStore<Bytes<U>,U>from - the index of the first byte to be movedto - the index where the first byte should be moved tolength - the number of bytes to be movednet.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 way.BufferUnderflowException - If there's not enough data to be movedIllegalStateException@NotNull public @NotNull Bytes<U> compact() throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
BytesThis operation is useful to free up space for writing by discarding bytes that have already been read.
NOTE: If the space freed in longs is less than 1/4 the readRemaining in longs, this method does nothing to reduce movement overhead
compact in interface Bytes<U>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 way@NotNull public @NotNull Bytes<U> readPosition(long position)
StreamingDataInputreadPosition in interface StreamingDataInput<Bytes<U>>position - the new read position, must be non-negative@NotNull public @NotNull Bytes<U> readLimit(long limit)
StreamingDataInputreadLimit in interface StreamingDataInput<Bytes<U>>limit - the new read limit, must be non-negative@NotNull public @NotNull Bytes<U> writePosition(long position)
StreamingDataOutputwritePosition in interface StreamingDataOutput<Bytes<U>>position - The new write position. It must be a non-negative number.@NotNull public @NotNull Bytes<U> readSkip(long bytesToSkip)
StreamingDataInputreadSkip in interface StreamingDataInput<Bytes<U>>bytesToSkip - the number of bytes to skippublic byte readVolatileByte(long offset)
throws BufferUnderflowException
RandomDataInputreadVolatileByte in interface RandomDataInputoffset - the location from where the byte value is read.BufferUnderflowException - If the offset is beyond the limits of the byte source.public short readVolatileShort(long offset)
throws BufferUnderflowException
RandomDataInputreadVolatileShort in interface RandomDataInputoffset - the location from where the short value is read.BufferUnderflowException - If the offset is beyond the limits of the byte source.public int readVolatileInt(long offset)
throws BufferUnderflowException
RandomDataInputreadVolatileInt in interface RandomDataInputoffset - the location from where the int value is read.BufferUnderflowException - If the offset is beyond the limits of the byte source.public long readVolatileLong(long offset)
throws BufferUnderflowException
RandomDataInputreadVolatileLong in interface RandomDataInputoffset - the location from where the long value is read.BufferUnderflowException - If the offset is beyond the limits of the byte source.public void uncheckedReadSkipOne()
StreamingDataInputuncheckedReadSkipOne in interface StreamingDataInput<Bytes<U>>public void uncheckedReadSkipBackOne()
StreamingDataInputuncheckedReadSkipBackOne in interface StreamingDataInput<Bytes<U>>@NotNull public @NotNull Bytes<U> writeSkip(long bytesToSkip)
StreamingDataOutputwriteSkip in interface StreamingDataOutput<Bytes<U>>bytesToSkip - The number of bytes to skip. This can be a negative number to move the
position backward.@NotNull public @NotNull Bytes<U> writeLimit(long limit)
StreamingDataOutputwriteLimit in interface StreamingDataOutput<Bytes<U>>limit - The new write limit. It must be a non-negative number.@NotNull public @NotNull BytesStore<Bytes<U>,U> copy()
BytesRandomCommon.readPosition() and RandomCommon.readLimit().
The copy will have its own separate storage and state, and modifications to the copy will not affect the original Bytes object, and vice versa.
public boolean isElastic()
BytesBytes.realCapacity().
Elastic Bytes objects can automatically grow to accommodate additional data, whereas non-elastic ones have a fixed capacity.
protected long readOffsetPositionMoved(long adding)
protected long writeOffsetPositionMoved(long adding)
protected long writeOffsetPositionMoved(long adding,
long advance)
protected long prewriteOffsetPositionMoved(long substracting)
@NotNull public @NotNull Bytes<U> write(@NotNull @NotNull RandomDataInput bytes, long offset, long length) throws BufferUnderflowException, BufferOverflowException, IllegalStateException
StreamingDataOutputRandomDataInput object into the output stream,
starting from the given read offset.
The position of this output stream is updated accordingly, but the read position of the input data is not changed.write in interface StreamingDataOutput<Bytes<U>>bytes - the RandomDataInput from which data is read.offset - the offset at which reading from the RandomDataInput starts.length - the number of bytes to write.BufferUnderflowException - If there is not enough data available in the input.BufferOverflowException - If there is not enough space left in the output stream.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 wayIllegalStateExceptionpublic long rawCopy(@NotNull
@NotNull RandomDataInput bytes,
long offset,
long length)
throws BufferOverflowException,
BufferUnderflowException,
IllegalStateException
@NotNull public @NotNull Bytes<U> clear()
Bytes@NotNull public @NotNull Bytes<U> clearAndPad(long length) throws BufferOverflowException
BytesPrependerclearAndPad in interface BytesPrepender<Bytes<U>>length - the padding lengthBufferOverflowException - If the length is greater than the difference of capacity() and start()public long readLimit()
If the resource is closed, the returned value is unspecified.
public long writeLimit()
If the resource is closed, the returned value is unspecified.
public long realCapacity()
BytesStorerealCapacity in interface Bytes<U>realCapacity in interface BytesStore<Bytes<U>,U>realCapacity in interface RandomDataInputrealCapacity in interface StreamingDataOutput<Bytes<U>>public long realWriteRemaining()
If the resource is closed, the returned value is unspecified.
public long capacity()
BytesStorecapacity in interface BytesStore<Bytes<U>,U>@Nullable public U underlyingObject()
underlyingObject in interface BytesStore<Bytes<U>,U>public long readPosition()
The read position is start() <= readPosition() && readPosition() <= readLimit() && readPosition < safeLimit()
If the resource is closed, the returned value is unspecified.
public long writePosition()
The write position is readPosition() <= writePosition() && writePosition() <= writeLimit()
If the resource is closed, the returned value is unspecified.
public boolean compareAndSwapInt(long offset,
int expected,
int value)
throws BufferOverflowException,
IllegalStateException
RandomDataInputcompareAndSwapInt in interface BytesStore<Bytes<U>,U>compareAndSwapInt in interface RandomDataInputcompareAndSwapInt in interface RandomDataOutput<Bytes<U>>offset - to perform CASexpected - valuevalue - to setBufferOverflowException - If the capacity of this RandomDataOutput was exceeded.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 wayIllegalStateExceptionpublic void testAndSetInt(long offset,
int expected,
int value)
throws BufferOverflowException,
IllegalStateException
RandomDataOutputtestAndSetInt in interface RandomDataInputtestAndSetInt in interface RandomDataOutput<Bytes<U>>offset - the offset at which to perform the test-and-set operation.expected - the expected current value.value - the new value to set if the current value matches the expected value.BufferOverflowException - If the capacity of this RandomDataOutput was exceeded.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 wayIllegalStateExceptionpublic boolean compareAndSwapLong(long offset,
long expected,
long value)
throws BufferOverflowException,
IllegalStateException
RandomDataInputcompareAndSwapLong in interface BytesStore<Bytes<U>,U>compareAndSwapLong in interface RandomDataInputcompareAndSwapLong in interface RandomDataOutput<Bytes<U>>offset - to perform CASexpected - valuevalue - to setBufferOverflowException - If the capacity of this RandomDataOutput was exceeded.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 wayIllegalStateExceptionprotected void performRelease()
throws IllegalStateException
performRelease in class net.openhft.chronicle.core.io.AbstractReferenceCountedIllegalStateExceptionpublic int readUnsignedByte()
StreamingDataInputreadUnsignedByte in interface StreamingDataInput<Bytes<U>>public int uncheckedReadUnsignedByte()
StreamingDataInputuncheckedReadUnsignedByte in interface StreamingDataInput<Bytes<U>>public byte readByte()
StreamingDataInputreadByte in interface StreamingDataInput<Bytes<U>>public int peekUnsignedByte()
StreamingDataInputpeekUnsignedByte in interface StreamingDataInput<Bytes<U>>public short readShort()
StreamingDataInputreadShort in interface StreamingDataInput<Bytes<U>>public int readInt()
StreamingDataInputreadInt in interface StreamingDataInput<Bytes<U>>public long readLong()
StreamingDataInputreadLong in interface StreamingDataInput<Bytes<U>>public float readFloat()
StreamingDataInputreadFloat in interface StreamingDataInput<Bytes<U>>public double readDouble()
StreamingDataInputreadDouble in interface StreamingDataInput<Bytes<U>>public int readVolatileInt()
StreamingDataInputreadVolatileInt in interface StreamingDataInput<Bytes<U>>public long readVolatileLong()
StreamingDataInputreadVolatileLong in interface StreamingDataInput<Bytes<U>>@NotNull public @NotNull Bytes<U> writeByte(long offset, byte i) throws BufferOverflowException, IllegalStateException
RandomDataOutputwriteByte in interface RandomDataOutput<Bytes<U>>offset - The non-negative position within the data stream to write the byte to.i - The byte value to write.BufferOverflowException - If the specified offset exceeds the available capacity.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 wayIllegalStateExceptionpublic Bytes<U> rawWriteByte(byte i8) throws BufferOverflowException, IllegalStateException
StreamingDataOutputrawWriteByte in interface StreamingDataOutput<Bytes<U>>i8 - The byte to be written.BufferOverflowException - If there is insufficient space in the buffer.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 wayIllegalStateException@NotNull public @NotNull Bytes<U> writeShort(long offset, short i) throws BufferOverflowException, IllegalStateException
RandomDataOutputwriteShort in interface RandomDataOutput<Bytes<U>>offset - The non-negative position within the data stream to write the short integer to.i - The short integer value to write.BufferOverflowException - If the specified offset exceeds the available capacity.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 wayIllegalStateException@NotNull public @NotNull Bytes<U> writeInt(long offset, int i) throws BufferOverflowException, IllegalStateException
RandomDataOutputwriteInt in interface RandomDataOutput<Bytes<U>>offset - The non-negative position within the data stream to write the integer to.i - The integer value to write.BufferOverflowException - If the specified offset exceeds the available capacity.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 wayIllegalStateException@NotNull public @NotNull Bytes<U> writeOrderedInt(long offset, int i) throws BufferOverflowException, IllegalStateException
RandomDataOutputwriteOrderedInt in interface RandomDataOutput<Bytes<U>>offset - The non-negative position within the data stream to write the integer to.i - The integer value to write.BufferOverflowException - If the specified offset exceeds the available capacity.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 wayIllegalStateException@NotNull public @NotNull Bytes<U> writeLong(long offset, long i) throws BufferOverflowException, IllegalStateException
RandomDataOutputwriteLong in interface RandomDataOutput<Bytes<U>>offset - The non-negative position within the data stream to write the long integer to.i - The long integer value to write.BufferOverflowException - If the specified offset exceeds the available capacity.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 wayIllegalStateException@NotNull public @NotNull Bytes<U> writeOrderedLong(long offset, long i) throws BufferOverflowException, IllegalStateException
RandomDataOutputwriteOrderedLong in interface RandomDataOutput<Bytes<U>>offset - The non-negative position within the data stream to write the long integer to.i - The long integer value to write.BufferOverflowException - If the specified offset exceeds the available capacity.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 wayIllegalStateException@NotNull public @NotNull Bytes<U> writeFloat(long offset, float d) throws BufferOverflowException, IllegalStateException
RandomDataOutputwriteFloat in interface RandomDataOutput<Bytes<U>>offset - The non-negative position within the data stream to write the float to.d - The float value to write.BufferOverflowException - If the specified offset exceeds the available capacity.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 wayIllegalStateException@NotNull public @NotNull Bytes<U> writeDouble(long offset, double d) throws BufferOverflowException, IllegalStateException
RandomDataOutputwriteDouble in interface RandomDataOutput<Bytes<U>>offset - The non-negative position within the data stream to write the double to.d - The double value to write.BufferOverflowException - If the specified offset exceeds the available capacity.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 wayIllegalStateException@NotNull public @NotNull Bytes<U> writeVolatileByte(long offset, byte i8) throws BufferOverflowException, IllegalStateException
RandomDataOutputwriteVolatileByte in interface RandomDataOutput<Bytes<U>>offset - The non-negative position within the data stream to write the byte to.i8 - The byte value to write.BufferOverflowException - If the specified offset exceeds the available capacity.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 wayIllegalStateException@NotNull public @NotNull Bytes<U> writeVolatileShort(long offset, short i16) throws BufferOverflowException, IllegalStateException
RandomDataOutputwriteVolatileShort in interface RandomDataOutput<Bytes<U>>offset - The non-negative position within the data stream to write the short to.i16 - The short value to write.BufferOverflowException - If the specified offset exceeds the available capacity.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 wayIllegalStateException@NotNull public @NotNull Bytes<U> writeVolatileInt(long offset, int i32) throws BufferOverflowException, IllegalStateException
RandomDataOutputwriteVolatileInt in interface RandomDataOutput<Bytes<U>>offset - The non-negative position within the data stream to write the integer to.i32 - The integer value to write.BufferOverflowException - If the specified offset exceeds the available capacity.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 wayIllegalStateException@NotNull public @NotNull Bytes<U> writeVolatileLong(long offset, long i64) throws BufferOverflowException, IllegalStateException
RandomDataOutputwriteVolatileLong in interface RandomDataOutput<Bytes<U>>offset - The non-negative position within the data stream to write the long integer to.i64 - The long integer value to write.BufferOverflowException - If the specified offset exceeds the available capacity.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 wayIllegalStateException@NotNull public @NotNull Bytes<U> write(long offsetInRDO, byte[] byteArray, int offset, int length) throws BufferOverflowException, IllegalStateException
RandomDataOutputbyteArray to this Bytes object starting at writeOffset taking
content starting at readOffset but copying at most length bytes.
Does not update cursors e.g. writePosition()
write in interface RandomDataOutput<Bytes<U>>offsetInRDO - the non-negative offset within the data output where the segment should be written.byteArray - the byte array containing the segment to be written.offset - the non-negative offset within the byte array where the segment begins.length - the non-negative length of the segment.BufferOverflowException - If the capacity of this data output was exceeded.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 wayIllegalStateExceptionpublic void write(long offsetInRDO,
@NotNull
@NotNull ByteBuffer bytes,
int offset,
int length)
throws BufferOverflowException,
IllegalStateException
RandomDataOutput
Does not update cursors e.g. writePosition()
write in interface RandomDataOutput<Bytes<U>>offsetInRDO - the non-negative offset within the data output where the segment should be written.bytes - the ByteBuffer containing the segment to be written.offset - the non-negative offset within the ByteBuffer where the segment begins.length - the non-negative length of the segment.BufferOverflowException - If the capacity of this data output was exceeded.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 wayIllegalStateException@NotNull public @NotNull Bytes<U> write(long writeOffset, @NotNull @NotNull RandomDataInput bytes, long readOffset, long length) throws BufferUnderflowException, BufferOverflowException, IllegalStateException
RandomDataOutputwritePosition() of this output nor the RandomCommon.readPosition() of the input.write in interface RandomDataOutput<Bytes<U>>writeOffset - the non-negative offset within this data output where the segment should be written.bytes - the RandomDataInput source containing the segment to be written.readOffset - the non-negative offset within the source where the segment begins.length - the non-negative length of the segment.BufferUnderflowException - If the source does not have enough data to fill the length.BufferOverflowException - If the capacity of this data output was exceeded.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 wayIllegalStateExceptionpublic byte readByte(long offset)
RandomDataInputreadByte in interface RandomDataInputoffset - the location from where the byte value is read.public int readUnsignedByte(long offset)
RandomDataInputreadUnsignedByte in interface RandomDataInputoffset - the location from where the unsigned byte value is read.public int peekUnsignedByte(long offset)
RandomDataInputpeekUnsignedByte in interface RandomDataInputoffset - the location from where the unsigned byte value is read.public short readShort(long offset)
RandomDataInputreadShort in interface RandomDataInputoffset - the location from where the short value is read.public int readInt(long offset)
RandomDataInputreadInt in interface RandomDataInputoffset - the location from where the 32-bit integer value is read.public long readLong(long offset)
RandomDataInputreadLong in interface RandomDataInputoffset - the location from where the long value is read.public float readFloat(long offset)
RandomDataInputreadFloat in interface RandomDataInputoffset - the location from where the float value is read.public double readDouble(long offset)
RandomDataInputreadDouble in interface RandomDataInputoffset - the location from where the double value is read.@NotNull public @NotNull Bytes<U> writeByte(byte i8)
StreamingDataOutputwriteByte in interface StreamingDataOutput<Bytes<U>>i8 - The byte to be written.@NotNull public @NotNull Bytes<U> prewriteByte(byte i8)
BytesPrependerprewriteByte in interface BytesPrepender<Bytes<U>>i8 - the byte to prepend@NotNull public @NotNull Bytes<U> writeShort(short i16) throws IllegalStateException
StreamingDataOutputwriteShort in interface StreamingDataOutput<Bytes<U>>i16 - The short integer to be written.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 wayIllegalStateException@NotNull public @NotNull Bytes<U> prewriteShort(short i16) throws IllegalStateException
BytesPrependerprewriteShort in interface BytesPrepender<Bytes<U>>i16 - the short to prependnet.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 way.IllegalStateException@NotNull public @NotNull Bytes<U> writeInt(int i) throws IllegalStateException
StreamingDataOutputwriteInt in interface StreamingDataOutput<Bytes<U>>i - The integer to be written.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 wayIllegalStateException@NotNull public @NotNull Bytes<U> writeIntAdv(int i, int advance) throws IllegalStateException
StreamingDataOutputwriteIntAdv in interface StreamingDataOutput<Bytes<U>>i - The integer to be written.advance - The number of bytes to advance the write position after the integer has been written.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 wayIllegalStateException@NotNull public @NotNull Bytes<U> prewriteInt(int i) throws IllegalStateException
BytesPrependerprewriteInt in interface BytesPrepender<Bytes<U>>i - the int to prependnet.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 way.IllegalStateException@NotNull public @NotNull Bytes<U> writeLong(long i64) throws IllegalStateException
StreamingDataOutputwriteLong in interface StreamingDataOutput<Bytes<U>>i64 - The long integer to be written.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 wayIllegalStateException@NotNull public @NotNull Bytes<U> writeLongAdv(long i64, int advance) throws IllegalStateException
StreamingDataOutputwriteLongAdv in interface StreamingDataOutput<Bytes<U>>i64 - The long integer to be written.advance - The number of bytes to advance the write position after the long integer has been written.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 wayIllegalStateException@NotNull public @NotNull Bytes<U> prewriteLong(long i64) throws IllegalStateException
BytesPrependerprewriteLong in interface BytesPrepender<Bytes<U>>i64 - the long to prependnet.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 way.IllegalStateException@NotNull public @NotNull Bytes<U> writeFloat(float f) throws IllegalStateException
StreamingDataOutputwriteFloat in interface StreamingDataOutput<Bytes<U>>f - The floating-point number to be written.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 wayIllegalStateException@NotNull public @NotNull Bytes<U> writeDouble(double d) throws IllegalStateException
StreamingDataOutputwriteDouble in interface StreamingDataOutput<Bytes<U>>d - The double-precision floating-point number to be written.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 wayIllegalStateException@NotNull public @NotNull Bytes<U> writeDoubleAndInt(double d, int i) throws IllegalStateException
StreamingDataOutputwriteDoubleAndInt in interface StreamingDataOutput<Bytes<U>>d - The double-precision floating-point number to be written.i - The integer to be written.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 wayIllegalStateException@NotNull public @NotNull Bytes<U> write(byte[] byteArray, int offset, int length) throws BufferOverflowException, IllegalStateException, ArrayIndexOutOfBoundsException
StreamingDataOutputbyteArray into the output stream, starting from the
given offset. The position of the output stream is updated according to the number of bytes written.write in interface StreamingDataOutput<Bytes<U>>byteArray - the array of bytes to be written.offset - the start index in the array from where to start writing bytes.length - the number of bytes to write.BufferOverflowException - If there is not enough space left in the output stream.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 wayArrayIndexOutOfBoundsException - If the provided offset and length combination is invalid.IllegalStateException@NotNull public @NotNull Bytes<U> prewrite(@NotNull @NotNull byte[] bytes) throws IllegalStateException, BufferOverflowException
BytesPrependerprewrite in interface BytesPrepender<Bytes<U>>bytes - the byte array to prependnet.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 way.BufferOverflowException - If the capacity of the underlying buffer was exceededIllegalStateException@NotNull public @NotNull Bytes<U> prewrite(@NotNull @NotNull BytesStore bytes) throws IllegalStateException, BufferOverflowException
BytesPrependerprewrite in interface BytesPrepender<Bytes<U>>bytes - the BytesStore to prependnet.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 way.BufferOverflowException - If the capacity of the underlying buffer was exceededIllegalStateException@NotNull public @NotNull Bytes<U> writeSome(@NotNull @NotNull ByteBuffer buffer) throws IllegalStateException
StreamingDataOutputByteBuffer into this Bytes object.
The number of bytes written is constrained by the space available in this Bytes object.
The position of this Bytes object is updated according to the number of bytes written.writeSome in interface StreamingDataOutput<Bytes<U>>buffer - the ByteBuffer from which data is read.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 wayIllegalStateException@NotNull public @NotNull Bytes<U> writeOrderedInt(int i) throws IllegalStateException
StreamingDataOutputwriteOrderedInt in interface StreamingDataOutput<Bytes<U>>i - The integer value to be written.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 wayIllegalStateException@NotNull public @NotNull Bytes<U> writeOrderedLong(long i) throws IllegalStateException
StreamingDataOutputwriteOrderedLong in interface StreamingDataOutput<Bytes<U>>i - The long value to be written.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 wayIllegalStateExceptionpublic long addressForRead(long offset)
throws BufferUnderflowException
offset - within this buffer. addressForRead(start()) is the actual addressForRead of the first byte.BufferUnderflowException - If the offset is before the start() or the after the capacity()public long addressForWrite(long offset)
throws BufferOverflowException
offset - within this buffer. addressForRead(start()) is the actual addressForRead of the first byte.BufferOverflowException - If the offset is before the start() or the after the capacity()public long addressForWritePosition()
throws UnsupportedOperationException,
BufferOverflowException
UnsupportedOperationException - If the underlying buffer is on the heap.BufferOverflowException - If the current write position is before the start or after the capacity.@NotNull public @NotNull String toString()
toString in interface CharSequencetoString in class net.openhft.chronicle.core.io.AbstractReferenceCountedpublic void lenient(boolean lenient)
StreamingDataInputfalse and empty string.lenient in interface StreamingDataInput<Bytes<U>>lenient - if true, return nothing rather than error.public boolean lenient()
lenient in interface StreamingDataInput<Bytes<U>>public void nativeRead(long position,
long address,
long size)
throws IllegalStateException,
BufferUnderflowException
RandomDataInputnativeRead in interface RandomDataInputposition - the starting point within the byte source from which data is copied.address - the destination address in native memory.size - the number of bytes to transfer.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 wayBufferUnderflowException - If the specified position or size exceeds the byte source limits.IllegalStateExceptionpublic void nativeWrite(long address,
long position,
long size)
throws IllegalStateException,
BufferOverflowException
RandomDataOutputnativeWrite in interface RandomDataOutput<Bytes<U>>address - the address in the native memory from where data should be copied.position - the position in the BytesStore where data should be written.size - the size of the data, in bytes, to be copied from the native memory.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 wayBufferOverflowException - If the capacity of this BytesStore was exceeded.IllegalStateException@Nullable public @Nullable BytesStore bytesStore()
BytesThe BytesStore represents the underlying storage of bytes that the Bytes object is manipulating.
bytesStore in interface Bytes<U>bytesStore in interface BytesStore<Bytes<U>,U>public int byteCheckSum()
throws net.openhft.chronicle.core.io.IORuntimeException
BytesStorebyteCheckSum in interface BytesStore<Bytes<U>,U>net.openhft.chronicle.core.io.IORuntimeException@NotNull public @NotNull Bytes<U> append8bit(@NotNull @NotNull CharSequence cs) throws BufferOverflowException, BufferUnderflowException, IllegalStateException
ByteStringAppenderappend8bit in interface ByteStringAppender<Bytes<U>>cs - the CharSequence to appendBufferOverflowException - If the string is too large to write in the capacity availableBufferUnderflowException - If the capacity of the underlying buffer was exceedednet.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 way.IllegalStateException@NotNull public @NotNull Bytes<U> appendUtf8(char[] chars, int offset, int length) throws BufferOverflowException, IllegalArgumentException, IllegalStateException
StreamingDataOutputappendUtf8 in interface StreamingDataOutput<Bytes<U>>chars - The CharSequence to be appended.offset - The offset from which to start writing the CharSequence.length - The number of characters from the CharSequence to write.BufferOverflowException - If there is not enough space left in the output stream.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 wayIllegalArgumentExceptionIllegalStateException@NotNull public @NotNull UncheckedNativeBytes<U> append(double d) throws BufferOverflowException, IllegalStateException
ByteStringAppenderappend in interface ByteStringAppender<Bytes<U>>d - to appendBufferOverflowException - If the capacity of the underlying buffer was exceedednet.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 way.IllegalStateException@NotNull public @NotNull UncheckedNativeBytes<U> append(float f) throws BufferOverflowException, IllegalStateException
ByteStringAppenderappend in interface ByteStringAppender<Bytes<U>>f - the float number to appendBufferOverflowException - If the relative append operation exceeds the underlying buffer's capacitynet.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 way.IllegalStateException@NotNull public @NotNull Bytes<U> append(int value) throws BufferOverflowException, IllegalArgumentException, IllegalStateException
ByteStringAppenderappend in interface ByteStringAppender<Bytes<U>>value - the integer value to appendBufferOverflowException - If the relative append operation exceeds the underlying buffer's capacitynet.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 way.IllegalArgumentExceptionIllegalStateException@NotNull public @NotNull Bytes<U> append(long value) throws BufferOverflowException, IllegalStateException
ByteStringAppenderappend in interface ByteStringAppender<Bytes<U>>value - the long number to appendBufferOverflowException - If the relative append operation exceeds the underlying buffer's capacitynet.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 way.IllegalStateExceptionpublic Decimaliser decimaliser()
ByteStringAppenderdecimaliser in interface ByteStringAppender<Bytes<U>>public Bytes<U> decimaliser(Decimaliser decimaliser)
ByteStringAppenderThe Decimaliser is an interface which can be implemented to provide custom logic for rendering decimal numbers in this ByteStringAppender.
decimaliser in interface ByteStringAppender<Bytes<U>>decimaliser - The Decimaliser to be associated with this ByteStringAppender.public boolean fpAppend0()
fpAppend0 in interface ByteStringAppender<Bytes<U>>public Bytes<U> fpAppend0(boolean append0)
fpAppend0 in interface ByteStringAppender<Bytes<U>>append0 - Does floating point add .0 to indicate it is a floating point even if redundant.public void append(boolean negative,
long mantissa,
int exponent)
DecimalAppenderappend in interface DecimalAppendernegative - Whether the number is negative. true indicates a negative number,
false indicates a positive number.mantissa - The significant digits of the decimal number, represented as a long integer.exponent - The power of 10 by which the mantissa is scaled to obtain the actual decimal number.public long appendAndReturnLength(long writePosition,
boolean negative,
long mantissa,
int exponent,
boolean append0)
appendAndReturnLength in interface RandomDataOutput<Bytes<U>>public int lastDecimalPlaces()
ByteStringParserByteStringParser.parseDouble() or ByteStringParser.parseLongDecimal() methods).lastDecimalPlaces in interface ByteStringParser<Bytes<U>>public void lastDecimalPlaces(int lastDecimalPlaces)
ByteStringParserlastDecimalPlaces in interface ByteStringParser<Bytes<U>>lastDecimalPlaces - the number of decimal places to set, if positive; otherwise 0.public boolean lastNumberHadDigits()
ByteStringParserlastNumberHadDigits in interface ByteStringParser<Bytes<U>>public void lastNumberHadDigits(boolean lastNumberHadDigits)
ByteStringParserlastNumberHadDigits in interface ByteStringParser<Bytes<U>>lastNumberHadDigits - the new value to set, true if the last parsed number had digits, false otherwise.@NotNull public @NotNull Bytes<U> write(@NotNull @NotNull RandomDataInput bytes) throws IllegalStateException
StreamingDataOutputRandomDataInput into the output stream.
The position of this output stream is updated accordingly, but the read position of the input data is not changed.
The operation will fail if there is not enough space left in the output stream.write in interface StreamingDataOutput<Bytes<U>>bytes - the RandomDataInput from which data is read.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 wayIllegalStateExceptionpublic long write8bit(long position,
@NotNull
@NotNull BytesStore bs)
RandomDataOutputwrite8bit in interface RandomDataOutput<Bytes<U>>position - the position at which the BytesStore content should be written.bs - the BytesStore instance to write.public long write8bit(long position,
@NotNull
@NotNull String s,
int start,
int length)
RandomDataOutputwrite8bit in interface RandomDataOutput<Bytes<U>>position - the position at which the string should be written.s - the string to write.start - the starting index from where characters are to be taken from the string.length - the number of characters to be written from the string.public Bytes<U> write8bit(@Nullable @Nullable BytesStore bs) throws BufferOverflowException, IllegalStateException, BufferUnderflowException
@NotNull public @NotNull Bytes<U> write8bit(@NotNull @NotNull String text, int start, int length)
StreamingDataOutputwrite8bit in interface StreamingDataOutput<Bytes<U>>text - The String to be written.start - The index of the first char in the String to write.length - The number of chars from the String to write.@NotNull public @NotNull UncheckedRandomDataInput acquireUncheckedInput()
HasUncheckedRandomDataInputacquireUncheckedInput in interface HasUncheckedRandomDataInput@Deprecated public byte[] internalNumberBuffer()
internalNumberBuffer in interface ByteStringAppender<Bytes<U>>internalNumberBuffer in interface RandomDataOutput<Bytes<U>>internalNumberBuffer in interface StreamingDataOutput<Bytes<U>>Copyright © 2023. All rights reserved.