public class HexDumpBytes extends Object implements Bytes<Void>, DecimalAppender
Bytes
interface for generating a hex dump of byte data. The hex dump is a
human-readable display of data in hexadecimal and ASCII formats. It's commonly used for debugging, forensics,
and analyzing low-level data.
It supports setting specific number wrap for byte data and custom offset formatting to provide more flexibility and control over the output of the hex dump. The class also enables indentation adjustment, which can be useful for nested data structures or logically grouped data within the byte array.
Modifier and Type | Field and Description |
---|---|
static long |
MASK |
DEFAULT_BYTE_BUFFER_CAPACITY, MAX_CAPACITY, MAX_HEAP_CAPACITY
JAVA9_STRING_CODER_LATIN, JAVA9_STRING_CODER_UTF16
Constructor and Description |
---|
HexDumpBytes()
Constructs a HexDumpBytes instance with default settings.
|
Modifier and Type | Method and Description |
---|---|
void |
addReferenceChangeListener(net.openhft.chronicle.core.io.ReferenceChangeListener referenceChangeListener) |
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.
|
BytesOut<Void> |
adjustHexDumpIndentation(int n)
Adjust the indent for nested data
|
@NotNull Bytes<Void> |
append(@NotNull BigDecimal bigDecimal)
Appends a string representation of a specified BigDecimal to this.
|
@NotNull Bytes<Void> |
append(boolean flag)
Appends a boolean as 'T' or 'F' character.
|
void |
append(boolean isNegative,
long mantissa,
int exponent)
Appends a decimal number, represented by its sign, mantissa, and exponent, to a target.
|
@NotNull Bytes<Void> |
append(char ch)
Appends a UTF-8 encoded character to the buffer.
|
@NotNull Bytes<Void> |
append(@NotNull CharSequence cs)
Append a characters in UTF-8
|
@NotNull Bytes<Void> |
append(@NotNull CharSequence cs,
int start,
int end)
Appends a portion of a string to the Bytes in UTF-8.
|
@NotNull Bytes<Void> |
append(double d)
Appends a double in decimal notation
|
@NotNull Bytes<Void> |
append(double d,
int decimalPlaces)
Appends a double in decimal notation to a specific number of decimal places.
|
@NotNull Bytes<Void> |
append(float f)
Appends a float in decimal notation
|
@NotNull Bytes<Void> |
append(int value)
Appends an int in decimal to this.
|
@NotNull Bytes<Void> |
append(long value)
Appends a long value in decimal.
|
Bytes<Void> |
append8bit(@NotNull BytesStore bs)
Appends the ISO-8859-1 representation of the specified BytesStore.
|
Bytes<Void> |
append8bit(@NotNull BytesStore bs,
long start,
long end)
Appends a portion of a BytesStore to this in ISO-8859-1 format.
|
@NotNull Bytes<Void> |
append8bit(@NotNull CharSequence cs)
Appends a String to the Bytes in ISO-8859-1.
|
Bytes<Void> |
append8bit(@NotNull CharSequence cs,
int start,
int end)
Appends a portion of a string to this Bytes in ISO-8859-1.
|
Bytes<Void> |
append8bit(@NotNull String cs)
Appends the ISO-8859-1 representation of the specified String.
|
long |
appendAndReturnLength(long writePosition,
boolean negative,
long mantissa,
int exponent,
boolean append0) |
@NotNull Bytes<Void> |
appendBase(long value,
int base)
Appends a string representation of the first argument in the radix specified by the second argument.
|
@NotNull Bytes<Void> |
appendBase16(long value)
Appends the base 16 (hexadecimal) representation of the specified long value.
|
@NotNull Bytes<Void> |
appendBase16(long value,
int minDigits)
Appends the base 16 (hexadecimal) representation of the specified long value,
padding with leading zeroes if the number of digits is less than minDigits.
|
@NotNull Bytes<Void> |
appendDateMillis(long dateInMillis)
Converts a specified long number to a date in the format yyyymmdd and appends the date to this.
|
@NotNull Bytes<Void> |
appendDecimal(long value,
int decimalPlaces)
Appends a long in decimal with a given number of decimal places.
|
@NotNull Bytes<Void> |
appendTimeMillis(long timeOfDayInMillis)
Converts a specified long number to time of day and appends it to this.
|
@NotNull 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<Void> |
clear()
Clears the content of this Bytes object and resets its state.
|
@NotNull Bytes<Void> |
clearAndPad(long length)
Clears the buffer and pads it with a specified length to allow prepending later.
|
@NotNull Bytes<Void> |
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)
Performs a 32-bit compare-and-swap (CAS) operation at a given offset.
|
boolean |
compareAndSwapLong(long offset,
long expected,
long value)
Performs a 64-bit compare-and-swap (CAS) operation at a given offset.
|
BytesStore |
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<Void> |
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<Void> |
fpAppend0(boolean append0) |
static HexDumpBytes |
fromText(@NotNull CharSequence text)
Creates a HexDumpBytes instance from provided char sequence.
|
static HexDumpBytes |
fromText(@NotNull Reader reader)
Creates a HexDumpBytes instance from provided text reader.
|
int |
hashCode() |
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.
|
long |
lengthWritten(long startPosition)
Calculates the length of data written from the given start position.
|
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 |
numberWrap()
Retrieves the current number wrap setting.
|
HexDumpBytes |
numberWrap(int numberWrap)
Sets the number wrap for the hex dump.
|
HexDumpBytes |
offsetFormat(OffsetFormat offsetFormat)
Sets the offset format for the hex dump.
|
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.
|
@NotNull Bytes<Void> |
prewrite(byte[] bytes)
Writes a byte array backward in binary format.
|
@NotNull Bytes<Void> |
prewrite(BytesStore bytes)
Writes a BytesStore instance backward in binary format.
|
@NotNull Bytes<Void> |
prewriteByte(byte b)
Writes a byte backward in binary format.
|
@NotNull Bytes<Void> |
prewriteInt(int i)
Writes an int (4-byte int) backward in binary format.
|
@NotNull Bytes<Void> |
prewriteLong(long l)
Writes a long (8-byte int) backward in binary format.
|
@NotNull Bytes<Void> |
prewriteShort(short i)
Writes a short (2-byte int) backward in binary format.
|
int |
read(byte[] bytes)
Reads the input stream into the provided byte array.
|
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.
|
void |
read(@NotNull ByteBuffer buffer)
Reads the input stream into the provided ByteBuffer.
|
void |
read(@NotNull Bytes<?> bytes,
int length)
Transfers the specified number of bytes from the input stream into the provided Bytes object.
|
int |
read(char[] bytes,
int off,
int len)
Reads the input stream into the provided char array, starting from the given offset and reading up to the specified length.
|
@Nullable String |
read8bit()
Reads an 8-bit encoded string from the input stream.
|
boolean |
read8bit(@NotNull Bytes<?> b)
Reads an 8-bit encoded string from the input stream and appends it to the provided Bytes.
|
boolean |
read8bit(@NotNull StringBuilder sb)
Reads an 8-bit encoded string from the input stream and appends it to the provided StringBuilder.
|
@NotNull BigDecimal |
readBigDecimal()
Creates and returns a new BigDecimal representing the contents of this Bytes object.
|
@NotNull BigInteger |
readBigInteger()
Creates and returns a new BigInteger representing the contents of this Bytes object or
BigInteger.ZERO
if this Bytes object is empty. |
boolean |
readBoolean()
Reads a boolean value from the input stream.
|
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.
|
<E extends Enum<E>> |
readEnum(@NotNull Class<E> eClass)
Reads an Enum value from the input stream.
|
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.
|
void |
readHistogram(@NotNull net.openhft.chronicle.core.util.Histogram histogram)
Reads data from the input stream into the provided Histogram.
|
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.
|
int |
readInt24()
Reads a 24-bit signed integer value from the input stream.
|
long |
readLimit()
If the resource is closed, the returned value is unspecified.
|
@NotNull Bytes<Void> |
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.
|
<T extends ReadBytesMarshallable> |
readMarshallableLength16(@NotNull Class<T> clazz,
T using)
Reads the content of this Bytes object and converts it into an instance of the specified class.
|
long |
readPosition()
Returns the read position.
|
@NotNull Bytes<Void> |
readPosition(long position)
Sets the read position of this StreamingDataInput.
|
@NotNull Bytes<Void> |
readPositionRemaining(long position,
long remaining)
Sets the read position and limit of this StreamingDataInput based on the specified position and remaining values.
|
@NotNull Bytes<Void> |
readPositionUnlimited(long position)
Sets the read position of this StreamingDataInput without limiting it to the current read limit.
|
long |
readRemaining()
Calculates the number of bytes remaining that can be read from the current read position.
|
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<Void> |
readSkip(long bytesToSkip)
Skips the specified number of bytes by advancing the read position.
|
long |
readStopBit()
Reads a variable-length integer encoded using the stop bit encoding.
|
char |
readStopBitChar()
Reads a variable-length character encoded using the stop bit encoding.
|
double |
readStopBitDecimal()
Reads a decimal number represented as a variable-length double and scale encoded using the stop bit encoding.
|
double |
readStopBitDouble()
Reads a variable-length double encoded using the stop bit encoding.
|
int |
readUnsignedByte()
Reads the next unsigned 8-bit value from the input stream.
|
long |
readUnsignedInt()
Reads a 32-bit value from the input stream and converts it to an unsigned integer by masking the sign bit.
|
int |
readUnsignedInt24()
Reads a 24-bit unsigned integer value from the input stream.
|
int |
readUnsignedShort()
Reads a 16-bit value from the input stream and converts it to an unsigned short by masking the sign bit.
|
@Nullable String |
readUtf8()
Reads a UTF-8 encoded string from the input stream.
|
<C extends Appendable & CharSequence> |
readUtf8(C sb)
Reads a UTF-8 encoded string from the input stream and appends it to the provided appendable.
|
<C extends Appendable & CharSequence> |
readUtf8(long offset,
C sb)
Truncates
sb (it must be a StringBuilder or Bytes ) and reads a char
sequence from the given offset , encoded as Utf8, into it. |
<C extends Appendable & CharSequence> |
readUtf8Limited(long offset,
C sb,
int maxUtf8Len)
Truncates
sb (it must be a StringBuilder or Bytes ) and reads a char
sequence from the given offset , encoded as Utf8, into it. |
@Nullable String |
readUtf8Limited(long offset,
int maxUtf8Len)
Reads a char sequence from the given
offset , encoded as Utf8. |
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.
|
void |
readWithLength(@NotNull Bytes<?> bytes)
Reads data from the input stream with specified length into the provided Bytes.
|
void |
readWithLength(long length,
@NotNull BytesOut<Void> bytesOut)
Writes the specified number of bytes from this Bytes object into the provided
bytesOut . |
void |
readWithLength(long length,
@NotNull net.openhft.chronicle.core.util.ThrowingConsumer<Bytes<Void>,net.openhft.chronicle.core.io.IORuntimeException> bytesConsumer)
Perform a set of actions within a temporary bounds mode.
|
void |
readWithLength0(long length,
@NotNull net.openhft.chronicle.core.util.ThrowingConsumerNonCapturing<Bytes<Void>,net.openhft.chronicle.core.io.IORuntimeException,BytesOut> bytesConsumer,
StringBuilder sb,
BytesOut<?> toBytes)
Perform a set of actions within a temporary bounds mode.
|
int |
refCount() |
void |
release(net.openhft.chronicle.core.io.ReferenceOwner owner) |
void |
releaseLast(net.openhft.chronicle.core.io.ReferenceOwner owner) |
void |
removeReferenceChangeListener(net.openhft.chronicle.core.io.ReferenceChangeListener referenceChangeListener) |
void |
reserve(net.openhft.chronicle.core.io.ReferenceOwner owner) |
boolean |
retainedHexDumpDescription()
Do these Bytes support saving comments as descriptions for fields.
|
void |
singleThreadedCheckDisabled(boolean singleThreadedCheckDisabled) |
void |
singleThreadedCheckReset() |
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 |
toHexString()
Creates and returns a new String representing the contents of this Bytes object in hexadecimal form,
with comments describing the meaning of the bytes.
|
@NotNull String |
toString() |
boolean |
tryReserve(net.openhft.chronicle.core.io.ReferenceOwner owner) |
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.
|
@Nullable Void |
underlyingObject() |
@NotNull Bytes<Void> |
write(byte[] byteArray)
Writes all the bytes from the given
byteArray into the output stream. |
@NotNull Bytes<Void> |
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<Void> |
write(@NotNull BytesStore<?,?> bytes)
Writes all available data from the specified
BytesStore into the output stream. |
@NotNull Bytes<Void> |
write(@NotNull BytesStore bytes,
long offset,
long length)
Writes the specified number of bytes from the provided
BytesStore into the output stream,
starting from the given read offset. |
@NotNull Bytes<Void> |
write(@NotNull CharSequence text)
Writes the provided
text to this StreamingDataOutput at the current writePosition(). |
@NotNull Bytes<Void> |
write(@NotNull CharSequence text,
int startText,
int length)
Writes the provided
text to this StreamingDataOutput at the current writePosition() |
Bytes<?> |
write(@NotNull InputStream inputStream)
Writes the contents of the provided
inputStream into this Bytes object. |
@NotNull Bytes<Void> |
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<Void> |
write(long writeOffset,
@NotNull RandomDataInput bytes,
long readOffset,
long length)
Copies a segment from the provided RandomDataInput into this data output.
|
@NotNull Bytes<Void> |
write(@NotNull RandomDataInput bytes)
Writes all available data from the specified
RandomDataInput into the output stream. |
@NotNull Bytes<Void> |
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. |
@NotNull Bytes<Void> |
write8bit(@Nullable CharSequence text)
Writes a CharSequence as an 8-bit string to the data stream.
|
@NotNull Bytes<Void> |
write8bit(@NotNull CharSequence text,
int start,
int length)
Writes a subsequence of a CharSequence as an 8-bit string to the data stream.
|
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<Void> |
write8bit(@Nullable String s)
Writes a String as an 8-bit string to the data stream.
|
@NotNull Bytes<Void> |
write8bit(@NotNull String text,
int start,
int length)
Writes a subsequence of a String as an 8-bit string to the data stream.
|
void |
writeBigDecimal(@NotNull BigDecimal bd)
Writes the given BigDecimal into this Bytes object.
|
void |
writeBigInteger(@NotNull BigInteger bi)
Writes the given BigInteger into this Bytes object.
|
@NotNull Bytes<Void> |
writeBoolean(boolean flag)
Writes a boolean value to this output stream.
|
@NotNull Bytes<Void> |
writeByte(byte i8)
Writes a byte to the data stream.
|
@NotNull Bytes<Void> |
writeByte(long offset,
byte i8)
Writes a byte at the specified non-negative offset.
|
@NotNull Bytes<Void> |
writeDouble(double d)
Writes a double-precision floating-point number to the data stream.
|
@NotNull Bytes<Void> |
writeDouble(long offset,
double d)
Writes a double-precision floating-point value at the specified non-negative offset.
|
@NotNull Bytes<Void> |
writeDoubleAndInt(double d,
int i)
Writes a double-precision floating-point number followed by an integer to the data stream.
|
<E extends Enum<E>> |
writeEnum(E e)
Writes an enum value to this output stream by writing the enum's name.
|
@NotNull Bytes<Void> |
writeFloat(float f)
Writes a floating-point number to the data stream.
|
@NotNull Bytes<Void> |
writeFloat(long offset,
float d)
Writes a single-precision floating-point value at the specified non-negative offset.
|
Bytes<Void> |
writeHexDumpDescription(@NotNull CharSequence comment)
Add comment as appropriate for the toHexString format
|
void |
writeHistogram(@NotNull net.openhft.chronicle.core.util.Histogram histogram)
Writes the given Histogram object into this Bytes object.
|
@NotNull Bytes<Void> |
writeInt(int i)
Writes an integer to the data stream.
|
@NotNull Bytes<Void> |
writeInt(long offset,
int i)
Writes an integer value at the specified non-negative offset.
|
@NotNull Bytes<Void> |
writeInt24(int i)
Writes a 24-bit integer to the data stream.
|
@NotNull Bytes<Void> |
writeInt24(long offset,
int i)
Writes a 24-bit integer at the specified non-negative offset.
|
@NotNull Bytes<Void> |
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<Void> |
writeLimit(long limit)
Sets the limit for writing to the data stream.
|
@NotNull Bytes<Void> |
writeLong(long i64)
Writes a long integer to the data stream.
|
@NotNull Bytes<Void> |
writeLong(long offset,
long i)
Writes a long integer value at the specified non-negative offset.
|
@NotNull Bytes<Void> |
writeLongAdv(long i64,
int advance)
Writes a long integer to the data stream, then advances the write position by the specified amount.
|
void |
writeMarshallableLength16(@NotNull WriteBytesMarshallable marshallable)
Writes the content of the provided
marshallable into this Bytes object, including a 16-bit length indicator
preceding the actual object data. |
@NotNull Bytes<Void> |
writeOrderedInt(int i)
Writes an integer value to this output stream using an ordered-writing mechanism.
|
@NotNull Bytes<Void> |
writeOrderedInt(long offset,
int i)
Performs a non-blocking write operation with a memory barrier to ensure order of stores.
|
@NotNull Bytes<Void> |
writeOrderedLong(long i)
Writes a long value to this output stream using an ordered-writing mechanism.
|
@NotNull Bytes<Void> |
writeOrderedLong(long offset,
long i)
Performs a non-blocking write operation with a memory barrier to ensure order of stores.
|
long |
writePosition()
For HexDumpBytes it needs to remember the writePosition for the underlying bytes as well as the text hex dump, so it encodes both in one number so you can call writePosition later.
|
@NotNull Bytes<Void> |
writePosition(long position)
Sets the current write position in the data stream.
|
void |
writePositionRemaining(long position,
long length)
Sets the write position and the remaining length of writable bytes in this Bytes object.
|
long |
writeRemaining()
Calculates the number of bytes remaining that can be written from the current write position.
|
@NotNull Bytes<Void> |
writeShort(long offset,
short i)
Writes a short integer at the specified non-negative offset.
|
@NotNull Bytes<Void> |
writeShort(short i16)
Writes a short integer to the data stream.
|
@NotNull Bytes<Void> |
writeSkip(long bytesToSkip)
Skips a specified number of bytes from the current write position in the data stream.
|
@NotNull Bytes<Void> |
writeSome(@NotNull ByteBuffer buffer)
Writes the available data from the provided
ByteBuffer into this Bytes object. |
@NotNull Bytes<Void> |
writeStopBit(char x)
Writes a stop bit encoded char to the data stream.
|
@NotNull Bytes<Void> |
writeStopBit(double d)
Writes a stop bit encoded double value to the data stream.
|
@NotNull Bytes<Void> |
writeStopBit(long x)
Writes a stop bit encoded long to the data stream.
|
@NotNull Bytes<Void> |
writeStopBitDecimal(double d)
Writes a double value to the data stream with a stop bit encoded decimal.
|
@NotNull Bytes<Void> |
writeUnsignedByte(int i)
Writes an unsigned byte to the data stream.
|
@NotNull Bytes<Void> |
writeUnsignedInt(long i)
Writes an unsigned integer to the data stream.
|
@NotNull Bytes<Void> |
writeUnsignedInt24(int i)
Writes an unsigned 24-bit integer to the data stream.
|
@NotNull Bytes<Void> |
writeUnsignedShort(int u16)
Writes an unsigned short integer to the data stream.
|
@NotNull Bytes<Void> |
writeUtf8(@Nullable CharSequence text)
Writes a UTF-8 encoded string to the data stream, similar to writeUTF, but with a few differences.
|
@NotNull Bytes<Void> |
writeUtf8(@Nullable String text)
Writes a UTF-8 encoded String to the data stream.
|
@NotNull Bytes<Void> |
writeVolatileByte(long offset,
byte i8)
Writes a volatile byte at the specified non-negative offset.
|
@NotNull Bytes<Void> |
writeVolatileInt(long offset,
int i32)
Writes a volatile integer at the specified non-negative offset.
|
@NotNull Bytes<Void> |
writeVolatileLong(long offset,
long i64)
Writes a volatile long integer at the specified non-negative offset.
|
@NotNull Bytes<Void> |
writeVolatileShort(long offset,
short i16)
Writes a volatile short at the specified non-negative offset.
|
void |
writeWithLength(@NotNull RandomDataInput bytes)
Writes data from the provided RandomDataInput into this Bytes object with prefixed length.
|
@NotNull Bytes<Void> |
zeroOut(long start,
long end)
Fills the BytesStore with zeros.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
allocateDirect, 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, readWrite, realCapacity, safeLimit, sharedMemory, toHexString, toHexString, toString, toString, toString, unchecked, unchecked, unwrite, valueOf, wrapForRead, wrapForRead, wrapForWrite, wrapForWrite
addAndGetDouble, addAndGetDoubleNotAtomic, addAndGetFloat, addAndGetFloatNotAtomic, addAndGetInt, addAndGetIntNotAtomic, addAndGetLong, addAndGetShortNotAtomic, addAndGetUnsignedByteNotAtomic, byteCheckSum, byteCheckSum, charAt, cipher, cipher, compareAndSwapDouble, compareAndSwapFloat, contentEquals, elasticByteBuffer, endsWith, equalBytes, follow, forFields, from, hash, inside, inside, isEmpty, isEqual, lazyNativeBytesStoreWithFixedCapacity, length, nativePointer, nativeStore, nativeStoreFrom, nativeStoreWithFixedCapacity, startsWith, startsWith, subSequence, to8bitString, toDebugString, toDebugString, wrap, wrap, wrap, writeMaxInt, writeMaxLong
append, append, write, write, writeBoolean, writeByte, writeOrderedDouble, writeOrderedFloat, writeUnsignedByte, writeUnsignedInt, writeUnsignedShort, writeUtf8, writeUtf8Limited, writeVolatileDouble, writeVolatileFloat
chars, codePoints
bytesMethodReader, bytesMethodReaderBuilder, readObject
canReadDirect, canReadDirect, compareUtf8, copyTo, copyTo, fastHash, findByte, parseLong, peekVolatileInt, printable, read, readBoolean, readIncompleteLong, readUnsignedByte, readUnsignedInt, readUnsignedInt24, readUnsignedShort, 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, readChar, readIncompleteLong, readLimitToCapacity, readPositionForHeader, readUtf8, readUtf8, unsafeRead, unsafeReadObject, unsafeReadObject
bytesMethodWriter, writeObject
writer
appendUtf8, appendUtf8, appendUtf8, appendUtf8, appendUtf8, appendUtf8, canWriteDirect, copyFrom, outputStream, rawWriteByte, rawWriteInt, rawWriteLong, unsafeWrite, unsafeWriteObject, unsafeWriteObject, writeChar, writePositionForHeader
prepend
public static final long MASK
public HexDumpBytes()
public static HexDumpBytes fromText(@NotNull @NotNull Reader reader) throws NumberFormatException
reader
- Reader instance to read the text data.NumberFormatException
- if parsing a number fails.public static HexDumpBytes fromText(@NotNull @NotNull CharSequence text) throws NumberFormatException
text
- CharSequence to read the text data from.NumberFormatException
- if parsing a number fails.public HexDumpBytes offsetFormat(OffsetFormat offsetFormat)
offsetFormat
- The offset format to use.public int numberWrap()
public HexDumpBytes numberWrap(int numberWrap)
numberWrap
- The number wrap to use.public long readRemaining()
If the resource is closed, the returned value is unspecified.
public long writeRemaining()
If the resource is closed, the returned value is unspecified.
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.
@NotNull public @NotNull String toHexString()
Bytes
readPosition()
and encodes at most 1024 bytes.
Each line of the output string contains hexadecimal representation of 16 bytes, followed by comments describing the meaning of those bytes.
For example, if the Bytes object contains bytes representing the ASCII string "VMH", the output would be similar to this:
c3 76 6d 68 # vmh: b6 03 56 4d 48 # VMH
This is assumed to be used to print the contents on a best effort basis. If an Error occurs it will be returned in the String.
toHexString
in interface Bytes<Void>
@NotNull public @NotNull String toString()
toString
in interface CharSequence
toString
in class Object
public boolean retainedHexDumpDescription()
HexDumpBytesDescription
retainedHexDumpDescription
in interface HexDumpBytesDescription<BytesOut<Void>>
public Bytes<Void> writeHexDumpDescription(@NotNull @NotNull CharSequence comment) throws IllegalStateException
HexDumpBytesDescription
writeHexDumpDescription
in interface HexDumpBytesDescription<BytesOut<Void>>
comment
- to add (or ignore)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
public BytesOut<Void> adjustHexDumpIndentation(int n) throws IllegalStateException
HexDumpBytesDescription
adjustHexDumpIndentation
in interface HexDumpBytesDescription<BytesOut<Void>>
n
- +1 indent in, -1 reduce indentingIllegalStateException
public BytesStore copy()
Bytes
RandomCommon.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()
Bytes
Bytes.realCapacity()
.
Elastic Bytes objects can automatically grow to accommodate additional data, whereas non-elastic ones have a fixed capacity.
public 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<Void>
ensureCapacity
in interface StreamingDataOutput<Bytes<Void>>
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 wayIllegalArgumentException
IllegalStateException
@NotNull public @NotNull BytesStore bytesStore()
Bytes
The BytesStore represents the underlying storage of bytes that the Bytes object is manipulating.
bytesStore
in interface Bytes<Void>
bytesStore
in interface BytesStore<Bytes<Void>,Void>
@NotNull public @NotNull Bytes<Void> compact()
Bytes
This 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, this method does nothing to reduce movement overhead
@NotNull public @NotNull Bytes<Void> clear() throws IllegalStateException
Bytes
clear
in interface Bytes<Void>
clear
in interface StreamingCommon<Bytes<Void>>
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
public boolean isDirectMemory()
BytesStore
isDirectMemory
in interface BytesStore<Bytes<Void>,Void>
public long capacity()
BytesStore
capacity
in interface BytesStore<Bytes<Void>,Void>
public long addressForRead(long offset) throws UnsupportedOperationException, IllegalStateException, BufferUnderflowException
offset
- within this buffer. addressForRead(start()) is the actual addressForRead of the first byte.UnsupportedOperationException
- If the underlying buffer is on the heapnet.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 offset is before the start() or the after the capacity()IllegalStateException
public long addressForWrite(long offset) throws UnsupportedOperationException
offset
- within this buffer. addressForRead(start()) is the actual addressForRead of the first byte.UnsupportedOperationException
- If the underlying buffer is on the heappublic 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.public boolean compareAndSwapInt(long offset, int expected, int value) throws BufferOverflowException, IllegalStateException
RandomDataOutput
compareAndSwapInt
in interface RandomDataOutput<Bytes<Void>>
offset
- the offset at which to perform the CAS 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 wayIllegalStateException
public void testAndSetInt(long offset, int expected, int value) throws IllegalStateException, BufferOverflowException
RandomDataOutput
testAndSetInt
in interface RandomDataOutput<Bytes<Void>>
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.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 RandomDataOutput was exceeded.IllegalStateException
public boolean compareAndSwapLong(long offset, long expected, long value) throws BufferOverflowException, IllegalStateException
RandomDataOutput
compareAndSwapLong
in interface RandomDataOutput<Bytes<Void>>
offset
- the offset at which to perform the CAS 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 wayIllegalStateException
@Nullable public @Nullable Void underlyingObject()
underlyingObject
in interface BytesStore<Bytes<Void>,Void>
public void move(long from, long to, long length)
BytesStore
move
in interface BytesStore<Bytes<Void>,Void>
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 movedpublic void reserve(net.openhft.chronicle.core.io.ReferenceOwner owner) throws IllegalStateException
reserve
in interface net.openhft.chronicle.core.io.ReferenceCounted
IllegalStateException
public void release(net.openhft.chronicle.core.io.ReferenceOwner owner) throws IllegalStateException
release
in interface net.openhft.chronicle.core.io.ReferenceCounted
IllegalStateException
public void releaseLast(net.openhft.chronicle.core.io.ReferenceOwner owner) throws IllegalStateException
releaseLast
in interface net.openhft.chronicle.core.io.ReferenceCounted
IllegalStateException
public int refCount()
refCount
in interface net.openhft.chronicle.core.io.ReferenceCounted
public void addReferenceChangeListener(net.openhft.chronicle.core.io.ReferenceChangeListener referenceChangeListener)
addReferenceChangeListener
in interface net.openhft.chronicle.core.io.ReferenceCounted
public void removeReferenceChangeListener(net.openhft.chronicle.core.io.ReferenceChangeListener referenceChangeListener)
removeReferenceChangeListener
in interface net.openhft.chronicle.core.io.ReferenceCounted
public boolean tryReserve(net.openhft.chronicle.core.io.ReferenceOwner owner) throws IllegalStateException, IllegalArgumentException
tryReserve
in interface net.openhft.chronicle.core.io.ReferenceCounted
IllegalStateException
IllegalArgumentException
@NotNull public @NotNull Bytes<Void> writeByte(long offset, byte i8) throws BufferOverflowException, IllegalStateException
RandomDataOutput
writeByte
in interface RandomDataOutput<Bytes<Void>>
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<Void> writeShort(long offset, short i) throws BufferOverflowException, IllegalStateException
RandomDataOutput
writeShort
in interface RandomDataOutput<Bytes<Void>>
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<Void> writeInt24(long offset, int i) throws BufferOverflowException, IllegalStateException
RandomDataOutput
writeInt24
in interface RandomDataOutput<Bytes<Void>>
offset
- The non-negative position within the data stream to write the 24-bit integer to.i
- The integer value to write. Only the lowest 24 bits are used.BufferOverflowException
- If the specified offset plus two 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<Void> writeInt(long offset, int i) throws BufferOverflowException, IllegalStateException
RandomDataOutput
writeInt
in interface RandomDataOutput<Bytes<Void>>
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<Void> writeOrderedInt(long offset, int i) throws BufferOverflowException, IllegalStateException
RandomDataOutput
writeOrderedInt
in interface RandomDataOutput<Bytes<Void>>
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<Void> writeLong(long offset, long i) throws BufferOverflowException, IllegalStateException
RandomDataOutput
writeLong
in interface RandomDataOutput<Bytes<Void>>
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<Void> writeOrderedLong(long offset, long i) throws BufferOverflowException, IllegalStateException
RandomDataOutput
writeOrderedLong
in interface RandomDataOutput<Bytes<Void>>
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<Void> writeFloat(long offset, float d) throws BufferOverflowException, IllegalStateException
RandomDataOutput
writeFloat
in interface RandomDataOutput<Bytes<Void>>
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<Void> writeDouble(long offset, double d) throws BufferOverflowException, IllegalStateException
RandomDataOutput
writeDouble
in interface RandomDataOutput<Bytes<Void>>
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<Void> writeVolatileByte(long offset, byte i8) throws BufferOverflowException
RandomDataOutput
writeVolatileByte
in interface RandomDataOutput<Bytes<Void>>
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.@NotNull public @NotNull Bytes<Void> writeVolatileShort(long offset, short i16) throws BufferOverflowException
RandomDataOutput
writeVolatileShort
in interface RandomDataOutput<Bytes<Void>>
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.@NotNull public @NotNull Bytes<Void> writeVolatileInt(long offset, int i32) throws BufferOverflowException
RandomDataOutput
writeVolatileInt
in interface RandomDataOutput<Bytes<Void>>
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.@NotNull public @NotNull Bytes<Void> writeVolatileLong(long offset, long i64) throws BufferOverflowException
RandomDataOutput
writeVolatileLong
in interface RandomDataOutput<Bytes<Void>>
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.@NotNull public @NotNull Bytes<Void> write(long offsetInRDO, byte[] byteArray, int offset, int length)
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<Void>>
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.public void write(long offsetInRDO, @NotNull @NotNull ByteBuffer bytes, int offset, int length)
RandomDataOutput
Does not update cursors e.g. writePosition()
write
in interface RandomDataOutput<Bytes<Void>>
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.@NotNull public @NotNull Bytes<Void> write(long writeOffset, @NotNull @NotNull RandomDataInput bytes, long readOffset, long length)
RandomDataOutput
writePosition()
of this output nor the RandomCommon.readPosition()
of the input.write
in interface RandomDataOutput<Bytes<Void>>
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.public long write8bit(long position, @NotNull @NotNull BytesStore bs)
RandomDataOutput
write8bit
in interface RandomDataOutput<Bytes<Void>>
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)
RandomDataOutput
write8bit
in interface RandomDataOutput<Bytes<Void>>
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 void nativeWrite(long address, long position, long size)
RandomDataOutput
nativeWrite
in interface RandomDataOutput<Bytes<Void>>
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.@NotNull public @NotNull Bytes<Void> zeroOut(long start, long end) throws IllegalStateException
BytesStore
zeroOut
in interface BytesStore<Bytes<Void>,Void>
zeroOut
in interface RandomDataOutput<Bytes<Void>>
start
- first byte inclusiveend
- last byte exclusivenet.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<Void> readPosition(long position) throws BufferUnderflowException, IllegalStateException
StreamingDataInput
readPosition
in interface StreamingDataInput<Bytes<Void>>
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 wayIllegalStateException
@NotNull public @NotNull Bytes<Void> readLimit(long limit) throws BufferUnderflowException
StreamingDataInput
readLimit
in interface StreamingDataInput<Bytes<Void>>
limit
- the new read limit, must be non-negativeBufferUnderflowException
- If the new limit is less than the read position@NotNull public @NotNull Bytes<Void> readSkip(long bytesToSkip) throws BufferUnderflowException, IllegalStateException
StreamingDataInput
readSkip
in interface StreamingDataInput<Bytes<Void>>
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 wayIllegalStateException
public void uncheckedReadSkipOne()
StreamingDataInput
uncheckedReadSkipOne
in interface StreamingDataInput<Bytes<Void>>
public void uncheckedReadSkipBackOne()
StreamingDataInput
uncheckedReadSkipBackOne
in interface StreamingDataInput<Bytes<Void>>
public long readStopBit() throws net.openhft.chronicle.core.io.IORuntimeException, IllegalStateException, BufferUnderflowException
StreamingDataInput
BytesInternal.readStopBit(this)
.readStopBit
in interface StreamingDataInput<Bytes<Void>>
net.openhft.chronicle.core.io.IORuntimeException
- If an I/O error occursnet.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 there's not enough data to readIllegalStateException
public char readStopBitChar() throws net.openhft.chronicle.core.io.IORuntimeException, IllegalStateException, BufferUnderflowException
StreamingDataInput
BytesInternal.readStopBitChar(this)
.readStopBitChar
in interface StreamingDataInput<Bytes<Void>>
net.openhft.chronicle.core.io.IORuntimeException
- If an I/O error occursnet.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 there's not enough data to readIllegalStateException
public double readStopBitDouble() throws IllegalStateException
StreamingDataInput
BytesInternal.readStopBitDouble(this)
.readStopBitDouble
in interface StreamingDataInput<Bytes<Void>>
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
public double readStopBitDecimal() throws IllegalStateException, BufferUnderflowException
StreamingDataInput
readStopBitDecimal
in interface StreamingDataInput<Bytes<Void>>
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 there's not enough data to readIllegalStateException
public byte readByte() throws IllegalStateException
StreamingDataInput
readByte
in interface StreamingDataInput<Bytes<Void>>
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
public int readUnsignedByte() throws IllegalStateException
StreamingDataInput
readUnsignedByte
in interface StreamingDataInput<Bytes<Void>>
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
public int uncheckedReadUnsignedByte()
StreamingDataInput
uncheckedReadUnsignedByte
in interface StreamingDataInput<Bytes<Void>>
public short readShort() throws BufferUnderflowException, IllegalStateException
StreamingDataInput
readShort
in interface StreamingDataInput<Bytes<Void>>
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 wayIllegalStateException
public int readInt() throws BufferUnderflowException, IllegalStateException
StreamingDataInput
readInt
in interface StreamingDataInput<Bytes<Void>>
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 wayIllegalStateException
public long readLong() throws BufferUnderflowException, IllegalStateException
StreamingDataInput
readLong
in interface StreamingDataInput<Bytes<Void>>
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 wayIllegalStateException
public float readFloat() throws BufferUnderflowException, IllegalStateException
StreamingDataInput
readFloat
in interface StreamingDataInput<Bytes<Void>>
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 wayIllegalStateException
public double readDouble() throws BufferUnderflowException, IllegalStateException
StreamingDataInput
readDouble
in interface StreamingDataInput<Bytes<Void>>
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 wayIllegalStateException
public int readVolatileInt() throws BufferUnderflowException, IllegalStateException
StreamingDataInput
readVolatileInt
in interface StreamingDataInput<Bytes<Void>>
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 wayIllegalStateException
public long readVolatileLong() throws BufferUnderflowException, IllegalStateException
StreamingDataInput
readVolatileLong
in interface StreamingDataInput<Bytes<Void>>
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 wayIllegalStateException
public int peekUnsignedByte() throws IllegalStateException
StreamingDataInput
peekUnsignedByte
in interface StreamingDataInput<Bytes<Void>>
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
public int lastDecimalPlaces()
ByteStringParser
ByteStringParser.parseDouble()
or ByteStringParser.parseLongDecimal()
methods).lastDecimalPlaces
in interface ByteStringParser<Bytes<Void>>
public void lastDecimalPlaces(int lastDecimalPlaces)
ByteStringParser
lastDecimalPlaces
in interface ByteStringParser<Bytes<Void>>
lastDecimalPlaces
- the number of decimal places to set, if positive; otherwise 0.public boolean lastNumberHadDigits()
ByteStringParser
lastNumberHadDigits
in interface ByteStringParser<Bytes<Void>>
public void lastNumberHadDigits(boolean lastNumberHadDigits)
ByteStringParser
lastNumberHadDigits
in interface ByteStringParser<Bytes<Void>>
lastNumberHadDigits
- the new value to set, true if the last parsed number had digits, false otherwise.@NotNull public @NotNull BigDecimal readBigDecimal() throws BufferUnderflowException, ArithmeticException, IllegalStateException
StreamingDataInput
If this Byte object is empty, an object equal to BigDecimal.ZERO
is returned.
readBigDecimal
in interface StreamingDataInput<Bytes<Void>>
BufferUnderflowException
- If the content of this Bytes object is insufficient to be successfully convertedArithmeticException
- If the content of this Bytes object could not be successfully convertednet.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 BigInteger readBigInteger() throws BufferUnderflowException, ArithmeticException, IllegalStateException
StreamingDataInput
BigInteger.ZERO
if this Bytes object is empty.readBigInteger
in interface StreamingDataInput<Bytes<Void>>
BufferUnderflowException
- If the content of this Bytes object is insufficient to be successfully convertedArithmeticException
- If the content of this Bytes object could not be successfully convertednet.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
public void readWithLength(long length, @NotNull @NotNull BytesOut<Void> bytesOut) throws BufferUnderflowException, net.openhft.chronicle.core.io.IORuntimeException, IllegalStateException, BufferOverflowException
Bytes
bytesOut
.
This operation does not affect the readLimit or readPosition of this Bytes object.
readWithLength
in interface Bytes<Void>
length
- The number of bytes to write. Must be non-negative.bytesOut
- The target BytesOut object to write to. Must not be null.BufferUnderflowException
- If the specified length
is greater than the number of bytes available for reading from this Bytes object.net.openhft.chronicle.core.io.IORuntimeException
- If an error occurs while reading from this Bytes object or writing to bytesOut
.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 bytesOut
does not have enough capacity to hold the bytes being written.IllegalStateException
public <T extends ReadBytesMarshallable> T readMarshallableLength16(@NotNull @NotNull Class<T> clazz, @Nullable T using) throws BufferUnderflowException, IllegalStateException, net.openhft.chronicle.core.io.InvalidMarshallableException
Bytes
If the using
parameter is not null, this method will update its state with the read content.
Otherwise, it will create a new instance of the specified class.
readMarshallableLength16
in interface Bytes<Void>
readMarshallableLength16
in interface BytesIn<Void>
T
- The type of the object being read.clazz
- The class of the object to be read. Must not be null.using
- An optional instance to update with the read content. Can be null.using
was provided.BufferUnderflowException
- If there are not enough bytes in this Bytes object to read the content.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.net.openhft.chronicle.core.io.InvalidMarshallableException
- If the data in this Bytes object cannot be converted into an instance of the specified class.IllegalStateException
Bytes.writeMarshallableLength16(WriteBytesMarshallable)
@NotNull public @NotNull Bytes<Void> readPositionUnlimited(long position) throws BufferUnderflowException, IllegalStateException
StreamingDataInput
readPositionUnlimited
in interface StreamingDataInput<Bytes<Void>>
position
- the new read position, must be non-negativeBufferUnderflowException
- If the new position is greater than the 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 wayIllegalStateException
@NotNull public @NotNull Bytes<Void> readPositionRemaining(long position, long remaining) throws BufferUnderflowException, IllegalStateException
StreamingDataInput
readPositionRemaining
in interface StreamingDataInput<Bytes<Void>>
position
- the new read position, must be non-negativeremaining
- the remaining size, which is used to set the read limitBufferUnderflowException
- If the new position is greater than the read 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 wayIllegalStateException
public void readWithLength0(long length, @NotNull @NotNull net.openhft.chronicle.core.util.ThrowingConsumerNonCapturing<Bytes<Void>,net.openhft.chronicle.core.io.IORuntimeException,BytesOut> bytesConsumer, StringBuilder sb, BytesOut<?> toBytes) throws BufferUnderflowException, net.openhft.chronicle.core.io.IORuntimeException, IllegalStateException
StreamingDataInput
readWithLength0
in interface StreamingDataInput<Bytes<Void>>
length
- the length to set the temporary bounds tobytesConsumer
- the consumer to execute within the temporary boundssb
- the StringBuilder to usetoBytes
- the BytesOut to useBufferUnderflowException
- If the specified length is greater than the number of bytes remaining to readnet.openhft.chronicle.core.io.IORuntimeException
- If the bytesConsumer encounters an IO errornet.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
public void readWithLength(long length, @NotNull @NotNull net.openhft.chronicle.core.util.ThrowingConsumer<Bytes<Void>,net.openhft.chronicle.core.io.IORuntimeException> bytesConsumer) throws BufferUnderflowException, net.openhft.chronicle.core.io.IORuntimeException, IllegalStateException
StreamingDataInput
readWithLength
in interface StreamingDataInput<Bytes<Void>>
length
- the length to set the temporary bounds tobytesConsumer
- the consumer to execute within the temporary boundsBufferUnderflowException
- If the specified length is greater than the number of bytes remaining to readnet.openhft.chronicle.core.io.IORuntimeException
- If the bytesConsumer encounters an IO errornet.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
public boolean readBoolean() throws IllegalStateException
StreamingDataInput
BytesUtil.byteToBoolean(b)
.readBoolean
in interface StreamingDataInput<Bytes<Void>>
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
public int readUnsignedShort() throws BufferUnderflowException, IllegalStateException
StreamingDataInput
readUnsignedShort
in interface StreamingDataInput<Bytes<Void>>
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 wayIllegalStateException
public int readInt24() throws BufferUnderflowException, IllegalStateException
StreamingDataInput
readInt24
in interface StreamingDataInput<Bytes<Void>>
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 wayIllegalStateException
public int readUnsignedInt24() throws BufferUnderflowException, IllegalStateException
StreamingDataInput
readUnsignedInt24
in interface StreamingDataInput<Bytes<Void>>
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 wayIllegalStateException
public long readUnsignedInt() throws BufferUnderflowException, IllegalStateException
StreamingDataInput
readUnsignedInt
in interface StreamingDataInput<Bytes<Void>>
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 wayIllegalStateException
@Nullable public @Nullable String readUtf8() throws BufferUnderflowException, net.openhft.chronicle.core.io.IORuntimeException, IllegalStateException, ArithmeticException
StreamingDataInput
null
values and
utilizes stop bit encoding for length, saving one byte for strings shorter than 128 characters.readUtf8
in interface StreamingDataInput<Bytes<Void>>
null
if writeUtf8(null)
was calledBufferUnderflowException
- If there's not enough data to readnet.openhft.chronicle.core.io.IORuntimeException
- If an IO error occursnet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.ArithmeticException
- If numeric overflow or underflow occursIllegalStateException
@Nullable public @Nullable String read8bit() throws net.openhft.chronicle.core.io.IORuntimeException, BufferUnderflowException, IllegalStateException, ArithmeticException
StreamingDataInput
read8bit
in interface StreamingDataInput<Bytes<Void>>
null
if write8bit(null)
was callednet.openhft.chronicle.core.io.IORuntimeException
- If an IO error occursBufferUnderflowException
- If there's not enough data to readnet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.ArithmeticException
- If numeric overflow or underflow occursIllegalStateException
public <C extends Appendable & CharSequence> boolean readUtf8(@NotNull C sb) throws net.openhft.chronicle.core.io.IORuntimeException, IllegalArgumentException, BufferUnderflowException, IllegalStateException, ArithmeticException
StreamingDataInput
readUtf8()
, except it populates a provided appendable instead of creating a new string.readUtf8
in interface StreamingDataInput<Bytes<Void>>
sb
- the appendable to which the read string will be appendedtrue
if there was a String, or false
if it was null
net.openhft.chronicle.core.io.IORuntimeException
- If an IO error occursIllegalArgumentException
- If the appendable does not allow setting lengthBufferUnderflowException
- If there's not enough data to readnet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.ArithmeticException
- If numeric overflow or underflow occursIllegalStateException
public <C extends Appendable & CharSequence> long readUtf8(long offset, @NotNull C sb) throws net.openhft.chronicle.core.io.IORuntimeException, IllegalArgumentException, BufferUnderflowException, ArithmeticException, IllegalStateException
RandomDataInput
sb
(it must be a StringBuilder
or Bytes
) and reads a char
sequence from the given offset
, encoded as Utf8, into it. Returns offset after
the read Utf8, if a normal char sequence was read, or -1 - offset
, if null
was observed (in this case, sb
is truncated too, but not updated then, by querying
sb
only this case is indistinguishable from reading an empty char sequence).readUtf8
in interface RandomDataInput
C
- buffer type, must be StringBuilder
or Bytes
offset
- the offset in this RandomDataInput
to read char sequence fromsb
- the buffer to read char sequence into (truncated first)null
net.openhft.chronicle.core.io.IORuntimeException
- If the reading operation encounters an unexpected error.IllegalArgumentException
- If the buffer is not a StringBuilder
or Bytes
.BufferUnderflowException
- If the reading operation encounters the end of the byte source.ArithmeticException
- If the calculated length of the UTF-8 encoded string is invalid.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
RandomDataOutput.writeUtf8(long, CharSequence)
public <C extends Appendable & CharSequence> long readUtf8Limited(long offset, @NotNull C sb, int maxUtf8Len) throws net.openhft.chronicle.core.io.IORuntimeException, IllegalArgumentException, BufferUnderflowException, IllegalStateException
RandomDataInput
sb
(it must be a StringBuilder
or Bytes
) and reads a char
sequence from the given offset
, encoded as Utf8, into it. Returns offset after
the read Utf8, if a normal char sequence was read, or -1 - offset
, if null
was observed (in this case, sb
is truncated too, but not updated then, by querying
sb
only this case is indistinguishable from reading an empty char sequence). If
length of Utf8 encoding of the char sequence exceeds maxUtf8Len
,
ClosedIllegalStateException
is thrown.readUtf8Limited
in interface RandomDataInput
C
- buffer type, must be StringBuilder
or Bytes
offset
- the offset in this RandomDataInput
to read char sequence fromsb
- the buffer to read char sequence into (truncated first)maxUtf8Len
- the maximum allowed length of the char sequence in Utf8 encodingnull
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 waynet.openhft.chronicle.core.io.IORuntimeException
IllegalArgumentException
BufferUnderflowException
IllegalStateException
RandomDataOutput.writeUtf8Limited(long, CharSequence, int)
@Nullable public @Nullable String readUtf8Limited(long offset, int maxUtf8Len) throws BufferUnderflowException, net.openhft.chronicle.core.io.IORuntimeException, IllegalArgumentException, IllegalStateException
RandomDataInput
offset
, encoded as Utf8. If length of Utf8
encoding of the char sequence exceeds maxUtf8Len
, ClosedIllegalStateException
is thrown.readUtf8Limited
in interface RandomDataInput
offset
- the offset in this RandomDataInput
to read char sequence frommaxUtf8Len
- the maximum allowed length of the char sequence in Utf8 encodingnet.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
net.openhft.chronicle.core.io.IORuntimeException
IllegalArgumentException
IllegalStateException
RandomDataOutput.writeUtf8Limited(long, CharSequence, int)
public boolean read8bit(@NotNull @NotNull Bytes<?> b) throws BufferUnderflowException, IllegalStateException, BufferOverflowException, ArithmeticException
StreamingDataInput
read8bit
in interface StreamingDataInput<Bytes<Void>>
b
- the Bytes instance to which the read string will be appendedtrue
if there was a String, or false
if it was null
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 wayBufferOverflowException
- If the buffer is fullArithmeticException
- If numeric overflow or underflow occursIllegalStateException
public boolean read8bit(@NotNull @NotNull StringBuilder sb) throws net.openhft.chronicle.core.io.IORuntimeException, BufferUnderflowException, ArithmeticException, IllegalStateException
StreamingDataInput
read8bit
in interface StreamingDataInput<Bytes<Void>>
sb
- the StringBuilder to which the read string will be appendedtrue
if there was a String, or false
if it was null
net.openhft.chronicle.core.io.IORuntimeException
- If an IO error occursBufferUnderflowException
- If there's not enough data to readArithmeticException
- If numeric overflow or underflow occursnet.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
public int read(byte[] bytes) throws IllegalStateException, BufferUnderflowException
StreamingDataInput
read
in interface StreamingDataInput<Bytes<Void>>
bytes
- the byte array to fill with the read datanet.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 there's not enough data to readIllegalStateException
public int read(byte[] bytes, int off, int len) throws IllegalStateException, BufferUnderflowException
StreamingDataInput
read
in interface StreamingDataInput<Bytes<Void>>
bytes
- the byte array to fill with the read dataoff
- the start offset in the byte arraylen
- the maximum number of bytes 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 wayBufferUnderflowException
- If there's not enough data to readIllegalStateException
public int read(char[] bytes, int off, int len) throws IllegalStateException
StreamingDataInput
read
in interface StreamingDataInput<Bytes<Void>>
bytes
- the char array to fill with the read dataoff
- the start offset in the char arraylen
- the maximum number of chars 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 wayIllegalStateException
public void read(@NotNull @NotNull ByteBuffer buffer) throws IllegalStateException
StreamingDataInput
read
in interface StreamingDataInput<Bytes<Void>>
buffer
- the ByteBuffer to fill with the read datanet.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
public void read(@NotNull @NotNull Bytes<?> bytes, int length) throws BufferUnderflowException, IllegalStateException, BufferOverflowException
StreamingDataInput
read
in interface StreamingDataInput<Bytes<Void>>
bytes
- the Bytes object to fill with the read datalength
- the 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 wayBufferOverflowException
- If there's not enough space in the provided Bytes objectIllegalStateException
@NotNull public <E extends Enum<E>> E readEnum(@NotNull @NotNull Class<E> eClass) throws net.openhft.chronicle.core.io.IORuntimeException, BufferUnderflowException, IllegalStateException, ArithmeticException, BufferOverflowException
StreamingDataInput
readEnum
in interface StreamingDataInput<Bytes<Void>>
eClass
- the class of the Enumnet.openhft.chronicle.core.io.IORuntimeException
- If an I/O error occursBufferUnderflowException
- If there's not enough data to readnet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.ArithmeticException
- If the number format is invalidBufferOverflowException
- If there's not enough space in the bufferIllegalStateException
public void readHistogram(@NotNull @NotNull net.openhft.chronicle.core.util.Histogram histogram) throws BufferUnderflowException, IllegalStateException, ArithmeticException
StreamingDataInput
readHistogram
in interface StreamingDataInput<Bytes<Void>>
histogram
- the Histogram to fill with dataBufferUnderflowException
- If there's not enough data to readnet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.ArithmeticException
- If the number format is invalidIllegalStateException
public void readWithLength(@NotNull @NotNull Bytes<?> bytes) throws ArithmeticException, BufferOverflowException, IllegalStateException, BufferUnderflowException
StreamingDataInput
readWithLength
in interface StreamingDataInput<Bytes<Void>>
bytes
- the Bytes to fill with dataArithmeticException
- If the number format is invalidBufferOverflowException
- If there's not enough space in the buffernet.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 there's not enough data to readIllegalStateException
@NotNull public @NotNull Bytes<Void> writePosition(long position) throws BufferOverflowException
StreamingDataOutput
writePosition
in interface StreamingDataOutput<Bytes<Void>>
position
- The new write position. It must be a non-negative number.BufferOverflowException
- If the specified position exceeds the limit of the data buffer.@NotNull public @NotNull Bytes<Void> writeLimit(long limit) throws BufferOverflowException
StreamingDataOutput
writeLimit
in interface StreamingDataOutput<Bytes<Void>>
limit
- The new write limit. It must be a non-negative number.BufferOverflowException
- If the specified limit is less than the current write position.@NotNull public @NotNull Bytes<Void> writeSkip(long bytesToSkip) throws BufferOverflowException, IllegalStateException
StreamingDataOutput
writeSkip
in interface StreamingDataOutput<Bytes<Void>>
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 wayIllegalStateException
@NotNull public @NotNull Bytes<Void> writeByte(byte i8) throws BufferOverflowException, IllegalStateException
StreamingDataOutput
writeByte
in interface StreamingDataOutput<Bytes<Void>>
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
public long writePosition()
public long lengthWritten(long startPosition)
Typically this calculates the difference however for HexDumpBytes it's not as simple.
If the resource is closed, the returned value is unspecified.
startPosition
- The position to calculate the length from.@NotNull public @NotNull Bytes<Void> writeShort(short i16) throws BufferOverflowException, IllegalStateException
StreamingDataOutput
writeShort
in interface StreamingDataOutput<Bytes<Void>>
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 wayIllegalStateException
@NotNull public @NotNull Bytes<Void> writeInt(int i) throws BufferOverflowException, IllegalStateException
StreamingDataOutput
writeInt
in interface StreamingDataOutput<Bytes<Void>>
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 wayIllegalStateException
@NotNull public @NotNull Bytes<Void> writeIntAdv(int i, int advance) throws BufferOverflowException, IllegalStateException
StreamingDataOutput
writeIntAdv
in interface StreamingDataOutput<Bytes<Void>>
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 wayIllegalStateException
@NotNull public @NotNull Bytes<Void> writeLong(long i64) throws BufferOverflowException, IllegalStateException
StreamingDataOutput
writeLong
in interface StreamingDataOutput<Bytes<Void>>
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 wayIllegalStateException
@NotNull public @NotNull Bytes<Void> writeLongAdv(long i64, int advance) throws BufferOverflowException, IllegalStateException
StreamingDataOutput
writeLongAdv
in interface StreamingDataOutput<Bytes<Void>>
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 wayIllegalStateException
@NotNull public @NotNull Bytes<Void> writeFloat(float f) throws BufferOverflowException, IllegalStateException
StreamingDataOutput
writeFloat
in interface StreamingDataOutput<Bytes<Void>>
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 wayIllegalStateException
@NotNull public @NotNull Bytes<Void> writeDouble(double d) throws BufferOverflowException, IllegalStateException
StreamingDataOutput
writeDouble
in interface StreamingDataOutput<Bytes<Void>>
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 wayIllegalStateException
@NotNull public @NotNull Bytes<Void> writeDoubleAndInt(double d, int i) throws BufferOverflowException, IllegalStateException
StreamingDataOutput
writeDoubleAndInt
in interface StreamingDataOutput<Bytes<Void>>
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 wayIllegalStateException
@NotNull public @NotNull Bytes<Void> write(byte[] byteArray, int offset, int length) throws BufferOverflowException, IllegalArgumentException, IllegalStateException
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<Void>>
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.IllegalArgumentException
- If the provided offset
or length
is negativenet.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<Void> writeSome(@NotNull @NotNull ByteBuffer buffer) throws BufferOverflowException, IllegalStateException, BufferUnderflowException
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<Void>>
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.net.openhft.chronicle.core.io.ThreadingIllegalStateException
- If this resource was accessed by multiple threads in an unsafe wayBufferUnderflowException
- If there is not enough data available in the input ByteBuffer.IllegalStateException
@NotNull public @NotNull Bytes<Void> writeOrderedInt(int i) throws BufferOverflowException, IllegalStateException
StreamingDataOutput
writeOrderedInt
in interface StreamingDataOutput<Bytes<Void>>
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 wayIllegalStateException
@NotNull public @NotNull Bytes<Void> writeOrderedLong(long i) throws BufferOverflowException, IllegalStateException
StreamingDataOutput
writeOrderedLong
in interface StreamingDataOutput<Bytes<Void>>
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 wayIllegalStateException
@NotNull public @NotNull Bytes<Void> clearAndPad(long length) throws BufferOverflowException, IllegalStateException
BytesPrepender
clearAndPad
in interface BytesPrepender<Bytes<Void>>
length
- the padding lengthBufferOverflowException
- If the length is greater than the difference of capacity() and start()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<Void> prewrite(byte[] bytes)
BytesPrepender
prewrite
in interface BytesPrepender<Bytes<Void>>
bytes
- the byte array to prepend@NotNull public @NotNull Bytes<Void> prewrite(BytesStore bytes)
BytesPrepender
prewrite
in interface BytesPrepender<Bytes<Void>>
bytes
- the BytesStore to prepend@NotNull public @NotNull Bytes<Void> prewriteByte(byte b)
BytesPrepender
prewriteByte
in interface BytesPrepender<Bytes<Void>>
b
- the byte to prepend@NotNull public @NotNull Bytes<Void> prewriteShort(short i)
BytesPrepender
prewriteShort
in interface BytesPrepender<Bytes<Void>>
i
- the short to prepend@NotNull public @NotNull Bytes<Void> prewriteInt(int i)
BytesPrepender
prewriteInt
in interface BytesPrepender<Bytes<Void>>
i
- the int to prepend@NotNull public @NotNull Bytes<Void> prewriteLong(long l)
BytesPrepender
prewriteLong
in interface BytesPrepender<Bytes<Void>>
l
- the long to prependpublic byte readByte(long offset) throws BufferUnderflowException, IllegalStateException
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.net.openhft.chronicle.core.io.ThreadingIllegalStateException
- If this resource was accessed by multiple threads in an unsafe wayIllegalStateException
public int peekUnsignedByte(long offset) throws IllegalStateException, BufferUnderflowException
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 wayIllegalStateException
BufferUnderflowException
public short readShort(long offset) throws BufferUnderflowException, IllegalStateException
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.net.openhft.chronicle.core.io.ThreadingIllegalStateException
- If this resource was accessed by multiple threads in an unsafe wayIllegalStateException
public int readInt(long offset) throws BufferUnderflowException, IllegalStateException
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.net.openhft.chronicle.core.io.ThreadingIllegalStateException
- If this resource was accessed by multiple threads in an unsafe wayIllegalStateException
public long readLong(long offset) throws BufferUnderflowException, IllegalStateException
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.net.openhft.chronicle.core.io.ThreadingIllegalStateException
- If this resource was accessed by multiple threads in an unsafe wayIllegalStateException
public float readFloat(long offset) throws BufferUnderflowException, IllegalStateException
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.net.openhft.chronicle.core.io.ThreadingIllegalStateException
- If this resource was accessed by multiple threads in an unsafe wayIllegalStateException
public double readDouble(long offset) throws BufferUnderflowException, IllegalStateException
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.net.openhft.chronicle.core.io.ThreadingIllegalStateException
- If this resource was accessed by multiple threads in an unsafe wayIllegalStateException
public byte readVolatileByte(long offset) throws BufferUnderflowException, IllegalStateException
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 wayIllegalStateException
public short readVolatileShort(long offset) throws BufferUnderflowException, IllegalStateException
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 wayIllegalStateException
public int readVolatileInt(long offset) throws BufferUnderflowException, IllegalStateException
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 wayIllegalStateException
public long readVolatileLong(long offset) throws BufferUnderflowException, IllegalStateException
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 wayIllegalStateException
public void nativeRead(long position, long address, long size) throws BufferUnderflowException, IllegalStateException
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 wayIllegalStateException
public long readPosition()
The read position is start() <= readPosition() && readPosition() <= readLimit() && readPosition < safeLimit()
If the resource is closed, the returned value is unspecified.
public void lenient(boolean lenient)
StreamingDataInput
false
and empty string.lenient
in interface StreamingDataInput<Bytes<Void>>
lenient
- if true, return nothing rather than error.public boolean lenient()
lenient
in interface StreamingDataInput<Bytes<Void>>
@NotNull public @NotNull Bytes<Void> append(char ch) throws IllegalStateException
ByteStringAppender
append
in interface Appendable
append
in interface ByteStringAppender<Bytes<Void>>
ch
- the character to appendIllegalStateException
@NotNull public @NotNull Bytes<Void> append(@NotNull @NotNull CharSequence cs)
ByteStringAppender
append
in interface Appendable
append
in interface ByteStringAppender<Bytes<Void>>
cs
- the CharSequence to append@NotNull public @NotNull Bytes<Void> append(boolean flag) throws BufferOverflowException, IllegalStateException
ByteStringAppender
append
in interface ByteStringAppender<Bytes<Void>>
flag
- 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<Void> append(int value) throws BufferOverflowException, IllegalArgumentException, IllegalStateException
ByteStringAppender
append
in interface ByteStringAppender<Bytes<Void>>
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
IllegalStateException
@NotNull public @NotNull Bytes<Void> append(long value) throws BufferOverflowException, IllegalStateException
ByteStringAppender
append
in interface ByteStringAppender<Bytes<Void>>
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.IllegalStateException
@NotNull public @NotNull Bytes<Void> appendBase(long value, int base) throws BufferOverflowException, IllegalArgumentException, IllegalStateException, IndexOutOfBoundsException
ByteStringAppender
appendBase
in interface ByteStringAppender<Bytes<Void>>
value
- the number to appendbase
- the radix that the specified value should be converted to before appendBufferOverflowException
- If the relative append operation exceeds the underlying buffer's capacityIllegalArgumentException
- If the specified arguments are illegalnet.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
IndexOutOfBoundsException
@NotNull public @NotNull Bytes<Void> appendBase16(long value) throws BufferOverflowException, IllegalArgumentException, IllegalStateException
ByteStringAppender
appendBase16
in interface ByteStringAppender<Bytes<Void>>
value
- the long value to be converted to base 16 and appendedBufferOverflowException
- If the relative append operation exceeds the underlying buffer's capacityIllegalArgumentException
- If the specified argument is illegalnet.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<Void> appendBase16(long value, int minDigits) throws BufferOverflowException, IllegalArgumentException, IllegalStateException
ByteStringAppender
appendBase16
in interface ByteStringAppender<Bytes<Void>>
value
- the long value to be converted to base 16 and appendedminDigits
- the minimum number of digits to be appendedBufferOverflowException
- If the relative append operation exceeds the underlying buffer's capacityIllegalArgumentException
- If the specified argument is illegalnet.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<Void> appendDecimal(long value, int decimalPlaces) throws BufferOverflowException, IllegalStateException, ArithmeticException, IllegalArgumentException
ByteStringAppender
appendDecimal
in interface ByteStringAppender<Bytes<Void>>
value
- to appenddecimalPlaces
- to shift the decimal placeBufferOverflowException
- 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
- If the decimalPlaces is negative or too largeIllegalStateException
ArithmeticException
@NotNull public @NotNull Bytes<Void> append(double d, int decimalPlaces) throws BufferOverflowException, IllegalArgumentException, IllegalStateException, ArithmeticException
ByteStringAppender
If the number would normally be printed with more decimal places, the number is rounded.
append
in interface ByteStringAppender<Bytes<Void>>
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.net.openhft.chronicle.core.io.ThreadingIllegalStateException
- If this resource was accessed by multiple threads in an unsafe way.IllegalStateException
ArithmeticException
public Decimaliser decimaliser()
ByteStringAppender
decimaliser
in interface ByteStringAppender<Bytes<Void>>
public Bytes<Void> 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<Void>>
decimaliser
- The Decimaliser to be associated with this ByteStringAppender.public boolean fpAppend0()
fpAppend0
in interface ByteStringAppender<Bytes<Void>>
public Bytes<Void> fpAppend0(boolean append0)
fpAppend0
in interface ByteStringAppender<Bytes<Void>>
append0
- Does floating point add .0 to indicate it is a floating point even if redundant.public void append(boolean isNegative, long mantissa, int exponent)
DecimalAppender
append
in interface DecimalAppender
isNegative
- 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<Void>>
@NotNull public @NotNull Bytes<Void> append(@NotNull @NotNull CharSequence cs, int start, int end) throws IndexOutOfBoundsException
ByteStringAppender
append
in interface Appendable
append
in interface ByteStringAppender<Bytes<Void>>
cs
- the CharacterSequence to appendstart
- index of the first char inclusiveend
- index of the last char exclusiveIndexOutOfBoundsException
- If the specified indexes are out of range@NotNull public @NotNull Bytes<Void> append8bit(@NotNull @NotNull CharSequence cs) throws BufferOverflowException, BufferUnderflowException, IndexOutOfBoundsException, IllegalStateException
ByteStringAppender
append8bit
in interface ByteStringAppender<Bytes<Void>>
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.IndexOutOfBoundsException
IllegalStateException
public Bytes<Void> append8bit(@NotNull @NotNull BytesStore bs) throws BufferOverflowException, BufferUnderflowException, IllegalStateException
ByteStringAppender
append8bit
in interface ByteStringAppender<Bytes<Void>>
bs
- the BytesStore to appendBufferOverflowException
- If the BytesStore 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
public Bytes<Void> append8bit(@NotNull @NotNull String cs) throws BufferOverflowException, IllegalStateException
ByteStringAppender
append8bit
in interface ByteStringAppender<Bytes<Void>>
cs
- the String to appendBufferOverflowException
- If the string is too large to write in the capacity availablenet.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
public Bytes<Void> append8bit(@NotNull @NotNull CharSequence cs, int start, int end) throws IllegalArgumentException, BufferOverflowException, BufferUnderflowException, IndexOutOfBoundsException, IllegalStateException
ByteStringAppender
append8bit
in interface ByteStringAppender<Bytes<Void>>
cs
- the CharSequence to appendstart
- index of the first char of cs (inclusive) to appendend
- index of the last char of cs (exclusive) to appendIllegalArgumentException
- If the start or end is negative or too largeBufferOverflowException
- If the string is too large to write in the capacity availableBufferUnderflowException
- If the capacity of the underlying buffer was exceededIndexOutOfBoundsException
- If the start or the end are not valid for the CharSequencenet.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
public Bytes<Void> append8bit(@NotNull @NotNull BytesStore bs, long start, long end) throws IllegalArgumentException, BufferOverflowException, BufferUnderflowException, IndexOutOfBoundsException, IllegalStateException
ByteStringAppender
append8bit
in interface ByteStringAppender<Bytes<Void>>
bs
- the specified BytesStore that a portion of it will be appended to thisstart
- the index of first byte (inclusive) of bs to appendend
- the number of bytes of bs to appendIllegalArgumentException
- If an illegal argument is passed to the methodBufferOverflowException
- If the relative append operation exceeds the underlying buffer's capacityBufferUnderflowException
- If the capacity of the BytesStore was exceededIndexOutOfBoundsException
- If the specified indexes for the BytesStore are out of rangenet.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<Void> appendDateMillis(long dateInMillis) throws BufferOverflowException, IllegalStateException
ByteStringAppender
appendDateMillis
in interface ByteStringAppender<Bytes<Void>>
dateInMillis
- the specified long to convert to date and append to thisBufferOverflowException
- 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<Void> appendTimeMillis(long timeOfDayInMillis) throws BufferOverflowException, IllegalStateException, IllegalArgumentException
ByteStringAppender
Twelve bytes in the format of hh:mm:ss.ddd will be appended to this. hh, mm, ss and ddd represent hour, minute, second and millisecond.
appendTimeMillis
in interface ByteStringAppender<Bytes<Void>>
timeOfDayInMillis
- the long number that represents time of day in millisecondsBufferOverflowException
- 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
- If an illegal argument is passed to the methodIllegalStateException
@NotNull public @NotNull Bytes<Void> append(@NotNull @NotNull BigDecimal bigDecimal)
ByteStringAppender
The string representation of the BigDecimal number is a standard canonical string form as
described in BigDecimal.toString()
.
append
in interface ByteStringAppender<Bytes<Void>>
bigDecimal
- the specified BigDecimal to appendBigDecimal
@NotNull public @NotNull Bytes<Void> append(float f) throws BufferOverflowException, IllegalStateException
ByteStringAppender
append
in interface ByteStringAppender<Bytes<Void>>
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<Void> append(double d) throws BufferOverflowException, IllegalStateException
ByteStringAppender
append
in interface ByteStringAppender<Bytes<Void>>
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
public void writeMarshallableLength16(@NotNull @NotNull WriteBytesMarshallable marshallable) throws BufferOverflowException, BufferUnderflowException, IllegalStateException, net.openhft.chronicle.core.io.InvalidMarshallableException
Bytes
marshallable
into this Bytes object, including a 16-bit length indicator
preceding the actual object data. The length indicator denotes the number of bytes taken up by the object data.
This method is useful for serialization, as it writes not only the content of the marshallable
object
but also information about its size.
writeMarshallableLength16
in interface Bytes<Void>
writeMarshallableLength16
in interface BytesOut<Void>
marshallable
- The object to be serialized and written to this Bytes object. Must not be null.BufferOverflowException
- If there is not enough capacity in this Bytes object to store the serialized data.BufferUnderflowException
- If there is not enough data available 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.net.openhft.chronicle.core.io.InvalidMarshallableException
- If the object cannot be written due to invalid data.IllegalStateException
Bytes.readMarshallableLength16(Class, ReadBytesMarshallable)
public Bytes<?> write(@NotNull @NotNull InputStream inputStream) throws IOException, IllegalStateException, BufferOverflowException
Bytes
inputStream
into this Bytes object. Continues reading from the
inputStream
and writing into this Bytes object until the end of the stream is reached.
Note: This method does not close the provided inputStream
.
write
in interface Bytes<Void>
inputStream
- The input stream from which data is to be read. Must not be null.IOException
- If an I/O error occurs when reading from the inputStream
.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 there is not enough capacity in this Bytes object to write the data read from the input stream.IllegalStateException
@NotNull public @NotNull Bytes<Void> writeStopBit(long x) throws BufferOverflowException, IllegalStateException
StreamingDataOutput
writeStopBit
in interface StreamingDataOutput<Bytes<Void>>
x
- The long value to be written to the data stream.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<Void> writeStopBit(char x) throws BufferOverflowException, IllegalStateException
StreamingDataOutput
writeStopBit
in interface StreamingDataOutput<Bytes<Void>>
x
- The char value to be written to the data stream.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<Void> writeStopBit(double d) throws BufferOverflowException, IllegalStateException
StreamingDataOutput
writeStopBit
in interface StreamingDataOutput<Bytes<Void>>
d
- The double value to be written to the data stream.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<Void> writeStopBitDecimal(double d) throws BufferOverflowException, IllegalStateException
StreamingDataOutput
writeStopBitDecimal
in interface StreamingDataOutput<Bytes<Void>>
d
- The double value to be written to the data stream.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<Void> writeUtf8(@Nullable @Nullable CharSequence text) throws BufferOverflowException, IllegalStateException, IllegalArgumentException
StreamingDataOutput
writeUtf8
in interface StreamingDataOutput<Bytes<Void>>
text
- The string to be written. Can be null.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
IllegalArgumentException
@NotNull public @NotNull Bytes<Void> writeUtf8(@Nullable @Nullable String text) throws BufferOverflowException, IllegalStateException
StreamingDataOutput
writeUtf8
in interface StreamingDataOutput<Bytes<Void>>
text
- The string to be written. Can be null.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<Void> write8bit(@Nullable @Nullable CharSequence text) throws BufferOverflowException, IllegalStateException, BufferUnderflowException, ArithmeticException
StreamingDataOutput
write8bit
in interface StreamingDataOutput<Bytes<Void>>
text
- The CharSequence to be written. Can be null.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
BufferUnderflowException
ArithmeticException
@NotNull public @NotNull Bytes<Void> write8bit(@NotNull @NotNull CharSequence text, int start, int length) throws BufferOverflowException, IndexOutOfBoundsException, IllegalStateException, BufferUnderflowException, ArithmeticException
StreamingDataOutput
write8bit
in interface StreamingDataOutput<Bytes<Void>>
text
- The CharSequence to be written.start
- The index of the first char in the CharSequence to write.length
- The number of chars from the CharSequence to write.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 wayIndexOutOfBoundsException
IllegalStateException
BufferUnderflowException
ArithmeticException
@NotNull public @NotNull Bytes<Void> write8bit(@NotNull @NotNull String text, int start, int length) throws BufferOverflowException, IndexOutOfBoundsException, IllegalStateException, BufferUnderflowException, ArithmeticException
StreamingDataOutput
write8bit
in interface StreamingDataOutput<Bytes<Void>>
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
IllegalStateException
BufferUnderflowException
ArithmeticException
@NotNull public @NotNull Bytes<Void> write(@NotNull @NotNull CharSequence text) throws BufferOverflowException, IllegalStateException, IndexOutOfBoundsException
StreamingDataOutput
text
to this StreamingDataOutput at the current writePosition().write
in interface StreamingDataOutput<Bytes<Void>>
text
- to writeBufferOverflowException
- If the provided text
cannot be accommodated.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
IndexOutOfBoundsException
@NotNull public @NotNull Bytes<Void> write(@NotNull @NotNull CharSequence text, int startText, int length) throws BufferOverflowException, IndexOutOfBoundsException, IllegalStateException
StreamingDataOutput
text
to this StreamingDataOutput at the current writePosition()write
in interface StreamingDataOutput<Bytes<Void>>
text
- to writestartText
- offset from where text should be copied fromlength
- number of characters to write.BufferOverflowException
- If the provided text
cannot be accommodated.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 wayIndexOutOfBoundsException
IllegalStateException
@NotNull public @NotNull Bytes<Void> write8bit(@Nullable @Nullable String s) throws BufferOverflowException, IllegalStateException, ArithmeticException
StreamingDataOutput
write8bit
in interface StreamingDataOutput<Bytes<Void>>
s
- The String to be written. Can be null.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
ArithmeticException
@NotNull public @NotNull Bytes<Void> writeUnsignedByte(int i) throws BufferOverflowException, IllegalStateException, ArithmeticException
StreamingDataOutput
writeUnsignedByte
in interface StreamingDataOutput<Bytes<Void>>
i
- The integer to be written as an unsigned byte.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
ArithmeticException
@NotNull public @NotNull Bytes<Void> writeUnsignedShort(int u16) throws BufferOverflowException, IllegalStateException, ArithmeticException
StreamingDataOutput
writeUnsignedShort
in interface StreamingDataOutput<Bytes<Void>>
u16
- The integer to be written as an unsigned short.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
ArithmeticException
@NotNull public @NotNull Bytes<Void> writeInt24(int i) throws BufferOverflowException, IllegalStateException, ArithmeticException
StreamingDataOutput
writeInt24
in interface StreamingDataOutput<Bytes<Void>>
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 wayIllegalStateException
ArithmeticException
@NotNull public @NotNull Bytes<Void> writeUnsignedInt24(int i) throws BufferOverflowException, IllegalStateException, ArithmeticException
StreamingDataOutput
writeUnsignedInt24
in interface StreamingDataOutput<Bytes<Void>>
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 wayIllegalStateException
ArithmeticException
@NotNull public @NotNull Bytes<Void> writeUnsignedInt(long i) throws BufferOverflowException, ArithmeticException, IllegalStateException
StreamingDataOutput
writeUnsignedInt
in interface StreamingDataOutput<Bytes<Void>>
i
- The long to be written as an unsigned integer.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 wayArithmeticException
IllegalStateException
@NotNull public @NotNull Bytes<Void> write(@NotNull @NotNull RandomDataInput bytes) throws IllegalStateException, BufferOverflowException
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<Void>>
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 wayBufferOverflowException
- If there is not enough space left in the output stream.IllegalStateException
public Bytes<Void> write(@NotNull @NotNull BytesStore<?,?> bytes) throws IllegalStateException, BufferOverflowException
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<Void>>
bytes
- the BytesStore
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 wayBufferOverflowException
- If there is not enough space left in the output stream.IllegalStateException
StreamingDataInput.read(Bytes)
@NotNull public @NotNull Bytes<Void> write(@NotNull @NotNull RandomDataInput bytes, long offset, long length) throws BufferOverflowException, BufferUnderflowException, IllegalStateException, IllegalArgumentException
StreamingDataOutput
RandomDataInput
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<Void>>
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.BufferOverflowException
- If there is not enough space left in the output stream.BufferUnderflowException
- If there is not enough data available in the input.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 wayIllegalArgumentException
- If the readOffset
or length
are invalid.IllegalStateException
@NotNull public @NotNull Bytes<Void> write(@NotNull @NotNull BytesStore bytes, long offset, long length) throws BufferOverflowException, BufferUnderflowException, IllegalStateException, IllegalArgumentException
StreamingDataOutput
BytesStore
into the output stream,
starting from the given read offset. It ensures that the output stream has enough capacity
to accommodate the incoming bytes. 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<Void>>
bytes
- the BytesStore
from which data is read.offset
- the offset at which reading from the BytesStore
starts.length
- the number of bytes to write.BufferOverflowException
- If there is not enough space left in the output stream.BufferUnderflowException
- If there is not enough data available in the input.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 wayIllegalArgumentException
- If the readOffset
or length
are invalid.IllegalStateException
@NotNull public @NotNull Bytes<Void> write(byte[] byteArray) throws BufferOverflowException, IllegalStateException
StreamingDataOutput
byteArray
into the output stream. The position of the output stream
is updated according to the number of bytes written.write
in interface StreamingDataOutput<Bytes<Void>>
byteArray
- the array of bytes 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 wayIllegalStateException
@NotNull public @NotNull Bytes<Void> writeBoolean(boolean flag) throws BufferOverflowException, IllegalStateException
StreamingDataOutput
writeBoolean
in interface StreamingDataOutput<Bytes<Void>>
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 wayIllegalStateException
public <E extends Enum<E>> Bytes<Void> writeEnum(@NotNull E e) throws BufferOverflowException, IllegalStateException, ArithmeticException
StreamingDataOutput
writeEnum
in interface StreamingDataOutput<Bytes<Void>>
e
- The enum 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 wayArithmeticException
- If a numeric error occurs.IllegalStateException
public void writePositionRemaining(long position, long length) throws BufferOverflowException
StreamingDataOutput
writePositionRemaining
in interface StreamingDataOutput<Bytes<Void>>
position
- The new write position.length
- The new length of writable bytes remaining.BufferOverflowException
- If the provided position and length exceeds the size of the buffer.public void writeHistogram(@NotNull @NotNull net.openhft.chronicle.core.util.Histogram histogram) throws IllegalStateException, BufferOverflowException
StreamingDataOutput
writeHistogram
in interface StreamingDataOutput<Bytes<Void>>
histogram
- The Histogram object 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 wayBufferOverflowException
- If there is not enough space in this Bytes object to store the Histogram.IllegalStateException
public void writeBigDecimal(@NotNull @NotNull BigDecimal bd) throws IllegalArgumentException, IllegalStateException, BufferOverflowException
StreamingDataOutput
writeBigDecimal
in interface StreamingDataOutput<Bytes<Void>>
bd
- The BigDecimal object to be written.IllegalArgumentException
- If the BigDecimal cannot 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 wayBufferOverflowException
- If there is not enough space in this Bytes object to store the BigDecimal.IllegalStateException
public void writeBigInteger(@NotNull @NotNull BigInteger bi) throws IllegalArgumentException, IllegalStateException, BufferOverflowException
StreamingDataOutput
writeBigInteger
in interface StreamingDataOutput<Bytes<Void>>
bi
- The BigInteger object to be written.IllegalArgumentException
- If the BigInteger cannot 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 wayBufferOverflowException
- If there is not enough space in this Bytes object to store the BigInteger.IllegalStateException
public void writeWithLength(@NotNull @NotNull RandomDataInput bytes) throws IllegalStateException, BufferOverflowException
StreamingDataOutput
writeWithLength
in interface StreamingDataOutput<Bytes<Void>>
bytes
- The RandomDataInput source of data 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 wayBufferOverflowException
- If there is not enough space in this Bytes object to store the incoming data.IllegalStateException
public void singleThreadedCheckReset()
singleThreadedCheckReset
in interface net.openhft.chronicle.core.io.SingleThreadedChecked
public void singleThreadedCheckDisabled(boolean singleThreadedCheckDisabled)
singleThreadedCheckDisabled
in interface net.openhft.chronicle.core.io.SingleThreadedChecked
Copyright © 2023. All rights reserved.