U
- Underlying typepublic abstract class AbstractBytes<U> extends net.openhft.chronicle.core.io.AbstractReferenceCounted implements Bytes<U>, HasUncheckedRandomDataInput, DecimalAppender
Modifier and Type | Field and Description |
---|---|
protected @NotNull BytesStore<Bytes<U>,U> |
bytesStore |
protected static boolean |
DISABLE_THREAD_SAFETY
Deprecated.
|
protected boolean |
isPresent |
protected long |
readPosition |
protected long |
writeLimit |
referenceCounted, WARN_COUNT, WARN_NS
DEFAULT_BYTE_BUFFER_CAPACITY, MAX_CAPACITY, MAX_HEAP_CAPACITY
charToString
JAVA9_STRING_CODER_LATIN, JAVA9_STRING_CODER_UTF16
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 numeric value in decimal form with the specified mantissa and exponent,
handling negative values and decimal point placement.
|
@NotNull AbstractBytes<U> |
append(double d)
Appends the string representation of the given double value to the bytes.
|
@NotNull Bytes<U> |
append(double d,
int decimalPlaces)
Appends a double in decimal notation to a specific number of decimal places.
|
@NotNull Bytes<U> |
append(float f)
Appends the string representation of the given float value to the bytes.
|
@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.
|
long |
appendAndReturnLength(long writePosition,
boolean negative,
long mantissa,
int exponent,
boolean append0) |
int |
byteCheckSum()
Returns the bytes sum of the readable bytes in this BytesStore.
|
int |
byteCheckSum(int start,
int end)
Returns the bytes sum between the specified indexes; start (inclusive) and end (exclusive).
|
int |
byteCheckSum(long start,
long end)
Returns the bytes sum between the specified indexes; start (inclusive) and end (exclusive).
|
@NotNull BytesStore |
bytesStore()
Returns the backing BytesStore that this Bytes object wraps.
|
protected void |
bytesStore(BytesStore<Bytes<U>,U> bytesStore) |
boolean |
canReadDirect(long length)
Checks if the specified length of bytes can be read directly from native memory.
|
boolean |
canWriteDirect(long count)
Determines if the buffer can write the specified count of bytes directly.
|
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 read position to the start.
|
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.
|
int |
copyTo(byte[] bytes)
Copies data from this byte source into a byte array.
|
Decimaliser |
decimaliser()
Gets the Decimaliser currently associated with this ByteStringAppender.
|
Bytes<U> |
decimaliser(Decimaliser decimaliser)
Associates a Decimaliser with this ByteStringAppender.
|
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() . |
boolean |
isImmutableEmptyByteStore()
Returns if this ByteStore is an immutable empty ByteStore or if it is backed
by an immutable empty ByteStore.
|
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.
|
int |
length()
This method is inherited from CharSequence so result should be the length of the contained
chars sequence although it actually returns the number of underlying bytes.
|
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(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 l)
Writes a long (8-byte int) backward in binary format.
|
protected long |
prewriteOffsetPositionMoved(long subtracting) |
@NotNull Bytes<U> |
prewriteShort(short i)
Writes a short (2-byte int) backward in binary format.
|
int |
read(byte[] bytes,
int off,
int len)
Reads the input stream into the provided byte array, starting from the given offset and reading up to the specified length.
|
long |
read(long offsetInRDI,
byte[] bytes,
int offset,
int length)
Reads a sequence of bytes from the specified offset into a byte array.
|
byte |
readByte()
Reads a byte value from the input stream.
|
byte |
readByte(long offset)
Reads a byte value from a specific offset.
|
protected void |
readCheckOffset(long offset,
long adding,
boolean given) |
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.
|
long |
readPositionForHeader(boolean skipPadding)
Obtains the current read position, optionally skipping padding bytes if specified.
|
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.
|
protected int |
safeCopySize() |
long |
start() |
boolean |
startsWith(@Nullable BytesStore bytesStore)
Returns if the content of this BytesStore starts with bytes equal to the content of a specified BytesStore.
|
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() |
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.
|
protected void |
uncheckedWritePosition(long writePosition) |
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. |
Bytes<U> |
write(@NotNull BytesStore<?,?> bytes)
Writes all available data from the specified
BytesStore into the output stream. |
@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> |
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> |
writeBoolean(boolean flag)
Writes a boolean value to this output 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.
|
protected void |
writeCheckOffset(long offset,
long adding) |
@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, warnAndReleaseIfNotReleased
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
allocateDirect, allocateDirect, allocateElasticDirect, allocateElasticDirect, allocateElasticOnHeap, allocateElasticOnHeap, bytesForRead, bytesForWrite, copy, copyTo, copyTo, directFrom, elasticByteBuffer, elasticByteBuffer, elasticByteBuffer, elasticHeapByteBuffer, elasticHeapByteBuffer, empty, ensureCapacity, forFieldGroup, from, from, fromDirect, fromHexString, indexOf, indexOf, isClear, isEqual, 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, charAt, cipher, cipher, compareAndSwapDouble, compareAndSwapFloat, contentEquals, elasticByteBuffer, endsWith, equalBytes, follow, forFields, from, hash, inside, inside, isEmpty, isEqual, lazyNativeBytesStoreWithFixedCapacity, 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, createCharToString, fastHash, findByte, parseLong, peekVolatileInt, printable, readBoolean, readIncompleteLong, readUnsignedInt, readUnsignedInt24, readUnsignedShort, readUtf8, readUtf8Limited, readUtf8Limited, readVolatileDouble, readVolatileFloat, subBytes, toByteArray, toTemporaryDirectByteBuffer
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, 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, unsafeReadObject
bytesMethodWriter, writeObject
append, append, append, append, append, append8bit, append8bit, append8bit, append8bit, append8bit, appendBase, appendBase16, appendBase16, appendDateMillis, appendDecimal, appendTimeMillis, writer
appendUtf8, appendUtf8, appendUtf8, appendUtf8, appendUtf8, appendUtf8, copyFrom, outputStream, rawWriteByte, rawWriteInt, rawWriteLong, unsafeWrite, unsafeWriteObject, unsafeWriteObject, write, write, 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, writeWithLength
prepend
adjustHexDumpIndentation, retainedHexDumpDescription, writeHexDumpDescription
@Deprecated protected static final boolean DISABLE_THREAD_SAFETY
@NotNull protected @NotNull BytesStore<Bytes<U>,U> bytesStore
protected long readPosition
protected long writeLimit
protected boolean isPresent
public boolean isDirectMemory()
BytesStore
isDirectMemory
in interface BytesStore<Bytes<U>,U>
public boolean canReadDirect(long length)
RandomDataInput
canReadDirect
in interface RandomDataInput
length
- the number of bytes to check.public void move(long from, long to, long length) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, ArithmeticException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
BytesStore
move
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 movedBufferUnderflowException
- If there's not enough data to be movednet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.ArithmeticException
- If the move would result in an index overflownet.openhft.chronicle.core.io.ThreadingIllegalStateException
- If this resource was accessed by multiple threads in an unsafe way.@NotNull public @NotNull Bytes<U> compact() throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
Bytes
This operation is useful to free up space for writing by discarding bytes that have already been read.
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> clear() throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
Bytes
clear
in interface Bytes<U>
clear
in interface StreamingCommon<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> clearAndPad(long length) throws BufferOverflowException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
BytesPrepender
clearAndPad
in interface BytesPrepender<Bytes<U>>
length
- the padding lengthBufferOverflowException
- If the length is greater than the difference of capacity() and start()net.openhft.chronicle.core.io.ThreadingIllegalStateException
- If this resource was accessed by multiple threads in an unsafe waypublic 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()
BytesStore
realCapacity
in interface Bytes<U>
realCapacity
in interface BytesStore<Bytes<U>,U>
realCapacity
in interface RandomDataInput
realCapacity
in interface StreamingDataOutput<Bytes<U>>
public boolean canWriteDirect(long count)
StreamingDataOutput
canWriteDirect
in interface StreamingDataOutput<Bytes<U>>
count
- the number of bytes to write.public long capacity()
BytesStore
capacity
in interface BytesStore<Bytes<U>,U>
@Nullable public U underlyingObject()
underlyingObject
in interface BytesStore<Bytes<U>,U>
public int length()
BytesStore
length
in interface CharSequence
length
in interface BytesStore<Bytes<U>,U>
public long start()
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, net.openhft.chronicle.core.io.ClosedIllegalStateException
RandomDataInput
compareAndSwapInt
in interface BytesStore<Bytes<U>,U>
compareAndSwapInt
in interface RandomDataInput
compareAndSwapInt
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.public void testAndSetInt(long offset, int expected, int value) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
RandomDataOutput
testAndSetInt
in interface RandomDataInput
testAndSetInt
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.public boolean compareAndSwapLong(long offset, long expected, long value) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
RandomDataInput
compareAndSwapLong
in interface BytesStore<Bytes<U>,U>
compareAndSwapLong
in interface RandomDataInput
compareAndSwapLong
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 way@NotNull public @NotNull AbstractBytes<U> append(double d) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
append
in interface ByteStringAppender<Bytes<U>>
d
- the double value to append.BufferOverflowException
- If there is not enough space to write the double.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> append(float f) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
append
in interface ByteStringAppender<Bytes<U>>
f
- the float value to append.BufferOverflowException
- If there is not enough space to write the float.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> append(int value) throws BufferOverflowException, IllegalArgumentException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
ByteStringAppender
append
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.IllegalArgumentException
@NotNull public @NotNull Bytes<U> append(long value) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
ByteStringAppender
append
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.public Decimaliser decimaliser()
ByteStringAppender
decimaliser
in interface ByteStringAppender<Bytes<U>>
public Bytes<U> decimaliser(Decimaliser decimaliser)
ByteStringAppender
The 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) throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
append
in interface DecimalAppender
negative
- indicates if the number is negative.mantissa
- the mantissa of the number to append.exponent
- the exponent indicating the position of the decimal point.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 appendAndReturnLength(long writePosition, boolean negative, long mantissa, int exponent, boolean append0)
appendAndReturnLength
in interface RandomDataOutput<Bytes<U>>
@NotNull public @NotNull Bytes<U> append(double d, int decimalPlaces) throws BufferOverflowException, IllegalArgumentException, net.openhft.chronicle.core.io.ClosedIllegalStateException, ArithmeticException
ByteStringAppender
If the number would normally be printed with more decimal places, the number is rounded.
append
in interface ByteStringAppender<Bytes<U>>
d
- to appenddecimalPlaces
- to always produceBufferOverflowException
- If the capacity of the underlying buffer was exceededIllegalArgumentException
- If the decimalPlaces is negative or too largenet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.ArithmeticException
@NotNull public @NotNull Bytes<U> readPosition(long position) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataInput
readPosition
in interface StreamingDataInput<Bytes<U>>
position
- the new read position, must be non-negativeBufferUnderflowException
- If the new position is greater than the limitnet.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> readLimit(long limit) throws BufferUnderflowException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataInput
readLimit
in interface StreamingDataInput<Bytes<U>>
limit
- the new read limit, must be non-negativeBufferUnderflowException
- If the new limit is less than the read positionnet.openhft.chronicle.core.io.ThreadingIllegalStateException
- If this resource was accessed by multiple threads in an unsafe way@NotNull public @NotNull Bytes<U> writePosition(long position) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataOutput
writePosition
in interface StreamingDataOutput<Bytes<U>>
position
- The new write position. It must be a non-negative number.BufferOverflowException
- If the specified position exceeds the limit of the data 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 way@NotNull public @NotNull Bytes<U> readSkip(long bytesToSkip) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataInput
readSkip
in interface StreamingDataInput<Bytes<U>>
bytesToSkip
- the number of bytes to skipBufferUnderflowException
- If the new read position is outside the limits of the data sourcenet.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 readPositionForHeader(boolean skipPadding) throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataInput
readPositionForHeader
in interface StreamingDataInput<Bytes<U>>
skipPadding
- if true, aligns the read position to a 4-byte boundary by skipping padding bytesnet.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 void uncheckedReadSkipOne()
StreamingDataInput
uncheckedReadSkipOne
in interface StreamingDataInput<Bytes<U>>
public void uncheckedReadSkipBackOne()
StreamingDataInput
uncheckedReadSkipBackOne
in interface StreamingDataInput<Bytes<U>>
@NotNull public @NotNull Bytes<U> writeSkip(long bytesToSkip) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataOutput
writeSkip
in interface StreamingDataOutput<Bytes<U>>
bytesToSkip
- The number of bytes to skip. This can be a negative number to move the
position backward.BufferOverflowException
- If the new position calculated by the skip operation falls
outside the limits of the data 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 way@NotNull public @NotNull Bytes<U> writeLimit(long limit) throws BufferOverflowException
StreamingDataOutput
writeLimit
in interface StreamingDataOutput<Bytes<U>>
limit
- The new write limit. It must be a non-negative number.BufferOverflowException
- If the specified limit is less than the current write position.protected void performRelease() throws net.openhft.chronicle.core.io.ClosedIllegalStateException
performRelease
in class net.openhft.chronicle.core.io.AbstractReferenceCounted
net.openhft.chronicle.core.io.ClosedIllegalStateException
public int readUnsignedByte() throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataInput
readUnsignedByte
in interface StreamingDataInput<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 waypublic int readUnsignedByte(long offset) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
RandomDataInput
readUnsignedByte
in interface RandomDataInput
offset
- the location from where the unsigned byte value is read.BufferUnderflowException
- If the offset is outside the bounds of the byte source.net.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.public int uncheckedReadUnsignedByte()
StreamingDataInput
uncheckedReadUnsignedByte
in interface StreamingDataInput<Bytes<U>>
public byte readByte() throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataInput
readByte
in interface StreamingDataInput<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 waypublic int peekUnsignedByte() throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataInput
peekUnsignedByte
in interface StreamingDataInput<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 waypublic short readShort() throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataInput
readShort
in interface StreamingDataInput<Bytes<U>>
BufferUnderflowException
- If there's not enough data to readnet.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 int readInt() throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataInput
readInt
in interface StreamingDataInput<Bytes<U>>
BufferUnderflowException
- If there's not enough data to readnet.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 byte readVolatileByte(long offset) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
RandomDataInput
readVolatileByte
in interface RandomDataInput
offset
- the location from where the byte value is read.BufferUnderflowException
- If the offset is beyond the limits of the byte source.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 short readVolatileShort(long offset) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
RandomDataInput
readVolatileShort
in interface RandomDataInput
offset
- the location from where the short value is read.BufferUnderflowException
- If the offset is beyond the limits of the byte source.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 int readVolatileInt(long offset) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
RandomDataInput
readVolatileInt
in interface RandomDataInput
offset
- the location from where the int value is read.BufferUnderflowException
- If the offset is beyond the limits of the byte source.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 readVolatileLong(long offset) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
RandomDataInput
readVolatileLong
in interface RandomDataInput
offset
- the location from where the long value is read.BufferUnderflowException
- If the offset is beyond the limits of the byte source.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 readLong() throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataInput
readLong
in interface StreamingDataInput<Bytes<U>>
BufferUnderflowException
- If there's not enough data to readnet.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 float readFloat() throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataInput
readFloat
in interface StreamingDataInput<Bytes<U>>
BufferUnderflowException
- If there's not enough data to readnet.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 double readDouble() throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataInput
readDouble
in interface StreamingDataInput<Bytes<U>>
BufferUnderflowException
- If there's not enough data to readnet.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 int readVolatileInt() throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataInput
readVolatileInt
in interface StreamingDataInput<Bytes<U>>
BufferUnderflowException
- If there's not enough data to readnet.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 readVolatileLong() throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataInput
readVolatileLong
in interface StreamingDataInput<Bytes<U>>
BufferUnderflowException
- If there's not enough data to readnet.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 wayprotected long readOffsetPositionMoved(long adding) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
BufferUnderflowException
net.openhft.chronicle.core.io.ClosedIllegalStateException
net.openhft.chronicle.core.io.ThreadingIllegalStateException
@NotNull public @NotNull Bytes<U> writeByte(long offset, byte i) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
RandomDataOutput
writeByte
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.@NotNull public @NotNull Bytes<U> writeShort(long offset, short i) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
RandomDataOutput
writeShort
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.@NotNull public @NotNull Bytes<U> writeInt(long offset, int i) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
RandomDataOutput
writeInt
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.@NotNull public @NotNull Bytes<U> writeOrderedInt(long offset, int i) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
RandomDataOutput
writeOrderedInt
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.@NotNull public @NotNull Bytes<U> writeLong(long offset, long i) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
RandomDataOutput
writeLong
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.@NotNull public @NotNull Bytes<U> writeOrderedLong(long offset, long i) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
RandomDataOutput
writeOrderedLong
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.@NotNull public @NotNull Bytes<U> writeFloat(long offset, float d) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
RandomDataOutput
writeFloat
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.@NotNull public @NotNull Bytes<U> writeDouble(long offset, double d) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
RandomDataOutput
writeDouble
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.@NotNull public @NotNull Bytes<U> writeVolatileByte(long offset, byte i8) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
RandomDataOutput
writeVolatileByte
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.@NotNull public @NotNull Bytes<U> writeVolatileShort(long offset, short i16) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
RandomDataOutput
writeVolatileShort
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.@NotNull public @NotNull Bytes<U> writeVolatileInt(long offset, int i32) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
RandomDataOutput
writeVolatileInt
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.@NotNull public @NotNull Bytes<U> writeVolatileLong(long offset, long i64) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
RandomDataOutput
writeVolatileLong
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.@NotNull public @NotNull Bytes<U> write(@NotNull @NotNull RandomDataInput bytes) throws net.openhft.chronicle.core.io.ClosedIllegalStateException, BufferOverflowException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataOutput
RandomDataInput
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.BufferOverflowException
- If there is not enough space left in the output stream.net.openhft.chronicle.core.io.ThreadingIllegalStateException
- If this resource was accessed by multiple threads in an unsafe waypublic Bytes<U> write(@NotNull @NotNull BytesStore<?,?> bytes) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataOutput
BytesStore
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 BytesStore
from which data is read.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 wayStreamingDataInput.read(Bytes)
@NotNull public @NotNull Bytes<U> write(long offsetInRDO, byte[] byteArray, int offset, int length) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
RandomDataOutput
byteArray
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 waypublic void write(long offsetInRDO, @NotNull @NotNull ByteBuffer bytes, int offset, int length) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
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.@NotNull public @NotNull Bytes<U> write(long writeOffset, @NotNull @NotNull RandomDataInput bytes, long readOffset, long length) throws BufferOverflowException, BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
RandomDataOutput
writePosition()
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.BufferOverflowException
- If the capacity of this data output was exceeded.BufferUnderflowException
- If the source does not have enough data to fill the length.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> write8bit(@NotNull @NotNull String text, int start, int length) throws BufferOverflowException, IndexOutOfBoundsException, ArithmeticException, net.openhft.chronicle.core.io.ClosedIllegalStateException, BufferUnderflowException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataOutput
write8bit
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.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
IndexOutOfBoundsException
ArithmeticException
BufferUnderflowException
@NotNull public @NotNull Bytes<U> write8bit(@Nullable @Nullable BytesStore bs) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, BufferUnderflowException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
BufferOverflowException
net.openhft.chronicle.core.io.ClosedIllegalStateException
BufferUnderflowException
net.openhft.chronicle.core.io.ThreadingIllegalStateException
public long write8bit(long position, @NotNull @NotNull BytesStore bs) throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
RandomDataOutput
write8bit
in interface RandomDataOutput<Bytes<U>>
position
- the position at which the BytesStore content should be written.bs
- the BytesStore instance to write.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 write8bit(long position, @NotNull @NotNull String s, int start, int length) throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
RandomDataOutput
write8bit
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.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 wayprotected void writeCheckOffset(long offset, long adding) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
BufferOverflowException
net.openhft.chronicle.core.io.ClosedIllegalStateException
net.openhft.chronicle.core.io.ThreadingIllegalStateException
public byte readByte(long offset) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
RandomDataInput
readByte
in interface RandomDataInput
offset
- the location from where the byte value is read.BufferUnderflowException
- If the offset is outside the bounds of the byte source.net.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.public int peekUnsignedByte(long offset) throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
RandomDataInput
peekUnsignedByte
in interface RandomDataInput
offset
- the location from where the unsigned byte value 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 waypublic short readShort(long offset) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
RandomDataInput
readShort
in interface RandomDataInput
offset
- the location from where the short value is read.BufferUnderflowException
- If the offset is outside the bounds of the byte source.net.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.public int readInt(long offset) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
RandomDataInput
readInt
in interface RandomDataInput
offset
- the location from where the 32-bit integer value is read.BufferUnderflowException
- If the offset is outside the bounds of the byte source.net.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.public long readLong(long offset) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
RandomDataInput
readLong
in interface RandomDataInput
offset
- the location from where the long value is read.BufferUnderflowException
- If the offset is outside the bounds of the byte source.net.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.public float readFloat(long offset) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
RandomDataInput
readFloat
in interface RandomDataInput
offset
- the location from where the float value is read.BufferUnderflowException
- If the offset is beyond the limits of the byte source.net.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.public double readDouble(long offset) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
RandomDataInput
readDouble
in interface RandomDataInput
offset
- the location from where the double value is read.BufferUnderflowException
- If the offset is beyond the limits of the byte source.net.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.protected void readCheckOffset(long offset, long adding, boolean given) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
BufferUnderflowException
net.openhft.chronicle.core.io.ClosedIllegalStateException
net.openhft.chronicle.core.io.ThreadingIllegalStateException
@NotNull public @NotNull Bytes<U> writeByte(byte i8) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataOutput
writeByte
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 way@NotNull public @NotNull Bytes<U> prewrite(byte[] bytes) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
BytesPrepender
prewrite
in interface BytesPrepender<Bytes<U>>
bytes
- the byte array to prependBufferOverflowException
- If the capacity of the underlying buffer was exceedednet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.@NotNull public @NotNull Bytes<U> prewrite(@NotNull @NotNull BytesStore bytes) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
BytesPrepender
prewrite
in interface BytesPrepender<Bytes<U>>
bytes
- the BytesStore to prependBufferOverflowException
- If the capacity of the underlying buffer was exceedednet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.@NotNull public @NotNull Bytes<U> prewriteByte(byte i8) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
BytesPrepender
prewriteByte
in interface BytesPrepender<Bytes<U>>
i8
- the byte to prependBufferOverflowException
- If the capacity of the underlying buffer was exceedednet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.@NotNull public @NotNull Bytes<U> prewriteInt(int i) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
BytesPrepender
prewriteInt
in interface BytesPrepender<Bytes<U>>
i
- the int to prependBufferOverflowException
- If the capacity of the underlying buffer was exceedednet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.@NotNull public @NotNull Bytes<U> prewriteShort(short i) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
BytesPrepender
prewriteShort
in interface BytesPrepender<Bytes<U>>
i
- the short to prependBufferOverflowException
- If the capacity of the underlying buffer was exceedednet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.@NotNull public @NotNull Bytes<U> prewriteLong(long l) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
BytesPrepender
prewriteLong
in interface BytesPrepender<Bytes<U>>
l
- the long to prependBufferOverflowException
- If the capacity of the underlying buffer was exceedednet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.protected final long writeOffsetPositionMoved(long adding) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
BufferOverflowException
net.openhft.chronicle.core.io.ClosedIllegalStateException
net.openhft.chronicle.core.io.ThreadingIllegalStateException
protected long writeOffsetPositionMoved(long adding, long advance) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
BufferOverflowException
net.openhft.chronicle.core.io.ClosedIllegalStateException
net.openhft.chronicle.core.io.ThreadingIllegalStateException
protected void uncheckedWritePosition(long writePosition)
protected long prewriteOffsetPositionMoved(long subtracting) throws BufferOverflowException
BufferOverflowException
@NotNull public @NotNull Bytes<U> writeShort(short i16) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataOutput
writeShort
in interface StreamingDataOutput<Bytes<U>>
i16
- The short integer 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 way@NotNull public @NotNull Bytes<U> writeInt(int i) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataOutput
writeInt
in interface StreamingDataOutput<Bytes<U>>
i
- The integer 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 way@NotNull public @NotNull Bytes<U> writeIntAdv(int i, int advance) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataOutput
writeIntAdv
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.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 way@NotNull public @NotNull Bytes<U> writeLong(long i64) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataOutput
writeLong
in interface StreamingDataOutput<Bytes<U>>
i64
- The long integer 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 way@NotNull public @NotNull Bytes<U> writeLongAdv(long i64, int advance) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataOutput
writeLongAdv
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.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 way@NotNull public @NotNull Bytes<U> writeFloat(float f) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataOutput
writeFloat
in interface StreamingDataOutput<Bytes<U>>
f
- The floating-point number 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 way@NotNull public @NotNull Bytes<U> writeDouble(double d) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataOutput
writeDouble
in interface StreamingDataOutput<Bytes<U>>
d
- The double-precision floating-point number 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 way@NotNull public @NotNull Bytes<U> writeDoubleAndInt(double d, int i) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataOutput
writeDoubleAndInt
in interface StreamingDataOutput<Bytes<U>>
d
- The double-precision floating-point number to be written.i
- The integer 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 waypublic int read(byte[] bytes, int off, int len) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataInput
read
in interface StreamingDataInput<Bytes<U>>
bytes
- the byte array to fill with the read dataoff
- the start offset in the byte arraylen
- the maximum number of bytes to readBufferUnderflowException
- If there's not enough data to readnet.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 read(long offsetInRDI, byte[] bytes, int offset, int length) throws net.openhft.chronicle.core.io.ClosedIllegalStateException
RandomDataInput
read
in interface RandomDataInput
offsetInRDI
- the offset in the byte sequence from which to start reading.bytes
- the byte array into which the data is read.offset
- the start offset in the byte array at which the data is written.length
- the maximum number of bytes to read.net.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.@NotNull public @NotNull Bytes<U> write(byte[] byteArray, int offset, int length) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, IllegalArgumentException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataOutput
byteArray
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.IllegalArgumentException
- If the provided offset
or length
is negativenet.openhft.chronicle.core.io.ThreadingIllegalStateException
- If this resource was accessed by multiple threads in an unsafe wayprotected int safeCopySize()
@NotNull public @NotNull Bytes<U> writeSome(@NotNull @NotNull ByteBuffer buffer) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, BufferUnderflowException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataOutput
ByteBuffer
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.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.BufferUnderflowException
- If there is not enough data available in the input ByteBuffer.net.openhft.chronicle.core.io.ThreadingIllegalStateException
- If this resource was accessed by multiple threads in an unsafe way@NotNull public @NotNull Bytes<U> writeBoolean(boolean flag) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataOutput
writeBoolean
in interface StreamingDataOutput<Bytes<U>>
flag
- The boolean value to be written.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 way@NotNull public @NotNull Bytes<U> writeOrderedInt(int i) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataOutput
writeOrderedInt
in interface StreamingDataOutput<Bytes<U>>
i
- The integer value to be written.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 way@NotNull public @NotNull Bytes<U> writeOrderedLong(long i) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
StreamingDataOutput
writeOrderedLong
in interface StreamingDataOutput<Bytes<U>>
i
- The long value to be written.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 waypublic long addressForRead(long offset) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
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()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 addressForWrite(long offset) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
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()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 addressForWritePosition() throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
BufferOverflowException
- If the current write position is before the start or after the capacity.net.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.@NotNull public @NotNull String toString()
toString
in interface CharSequence
toString
in class net.openhft.chronicle.core.io.AbstractReferenceCounted
public void nativeRead(long position, long address, long size) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
RandomDataInput
nativeRead
in interface RandomDataInput
position
- 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.BufferUnderflowException
- If the specified position or size exceeds the byte source limits.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 void nativeWrite(long address, long position, long size) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
RandomDataOutput
nativeWrite
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.BufferOverflowException
- If the capacity of this BytesStore 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 way@NotNull public @NotNull BytesStore bytesStore()
Bytes
The 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>
protected void bytesStore(BytesStore<Bytes<U>,U> bytesStore)
public int lastDecimalPlaces()
ByteStringParser
ByteStringParser.parseDouble()
or ByteStringParser.parseLongDecimal()
methods).lastDecimalPlaces
in interface ByteStringParser<Bytes<U>>
public void lastDecimalPlaces(int lastDecimalPlaces)
ByteStringParser
lastDecimalPlaces
in interface ByteStringParser<Bytes<U>>
lastDecimalPlaces
- the number of decimal places to set, if positive; otherwise 0.public boolean lastNumberHadDigits()
ByteStringParser
lastNumberHadDigits
in interface ByteStringParser<Bytes<U>>
public void lastNumberHadDigits(boolean lastNumberHadDigits)
ByteStringParser
lastNumberHadDigits
in interface ByteStringParser<Bytes<U>>
lastNumberHadDigits
- the new value to set, true if the last parsed number had digits, false otherwise.public boolean isElastic()
Bytes
Bytes.realCapacity()
.
Elastic Bytes objects can automatically grow to accommodate additional data, whereas non-elastic ones have a fixed capacity.
public void lenient(boolean lenient)
StreamingDataInput
false
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 int byteCheckSum() throws net.openhft.chronicle.core.io.IORuntimeException, BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
BytesStore
byteCheckSum
in interface BytesStore<Bytes<U>,U>
BufferUnderflowException
- If there's not enough data to be movednet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.net.openhft.chronicle.core.io.IORuntimeException
public int byteCheckSum(long start, long end) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
BytesStore
byteCheckSum
in interface BytesStore<Bytes<U>,U>
start
- the index of the first byte to sumend
- the index of the last byte to sumBufferUnderflowException
- If the specified indexes are outside the limits of the BytesStorenet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.public boolean startsWith(@Nullable @Nullable BytesStore bytesStore) throws net.openhft.chronicle.core.io.ClosedIllegalStateException
BytesStore
startsWith
in interface BytesStore<Bytes<U>,U>
bytesStore
- the BytesStore to compare withtrue
if the content of this BytesStore starts with bytesStorenet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.@NotNull public @NotNull UncheckedRandomDataInput acquireUncheckedInput()
HasUncheckedRandomDataInput
acquireUncheckedInput
in interface HasUncheckedRandomDataInput
public int byteCheckSum(int start, int end) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
start
- the index of the first byte to sumend
- the index of the last byte to sumBufferUnderflowException
- If the specified indexes are outside the limits of the BytesStorenet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.public boolean isImmutableEmptyByteStore()
BytesStore
isImmutableEmptyByteStore
in interface BytesStore<Bytes<U>,U>
public int copyTo(byte[] bytes) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
RandomDataInput
RandomCommon.readPosition()
up to RandomCommon.readLimit()
.copyTo
in interface RandomDataInput
bytes
- the target byte array to which the data is copied.BufferUnderflowException
- If the source's read position or limit is beyond the byte source limits.net.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.@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.