S
- the type of StreamingDataInputpublic interface StreamingDataInput<S extends StreamingDataInput<S>> extends StreamingCommon<S>
Reading methods in this interface are usually expected to advance the read position by the number of bytes read. This allows consecutive calls to the read methods to sequentially read chunks of data from the stream.
Additionally, StreamingDataInput provides support for leniency and conversion of data into BigInteger or BigDecimal objects. When lenient mode is enabled, methods will return default values when there's no more data to read, instead of throwing exceptions.
The interface includes methods for handling exceptions and managing the state of the stream, such as checking the remaining bytes or throwing an exception if the stream has been previously released.
Defines a data input interface that supports setting and getting positions and limits. Implementing classes can be used to read data from a data source, typically a byte stream or byte buffer.
Note: Implementations of this interface may choose to handle the actual reading of data in various ways, such as through direct memory access or other optimized mechanisms.
Modifier and Type | Method and Description |
---|---|
long |
addressForRead(long offset)
Retrieves the underlying memory address for reading.
|
default long |
addressForRead(long offset,
int buffer)
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.
|
default ByteOrder |
byteOrder()
Retrieves the byte order used by the buffer.
|
@NotNull Bytes<?> |
bytesForRead()
Retrieves a Bytes object for reading.
|
@NotNull Bytes<?> |
bytesForWrite()
Retrieves a Bytes object for writing.
|
default long |
capacity() |
long |
copyTo(@NotNull BytesStore to)
Copies the data from the input stream to the provided BytesStore.
|
void |
copyTo(@NotNull OutputStream out)
Copies the data from the input stream to the provided OutputStream.
|
default @NotNull InputStream |
inputStream()
Provides an InputStream for the data represented by this StreamingDataInput.
|
boolean |
isDirectMemory()
Checks if the buffer uses direct memory.
|
default 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. |
default long |
parseHexLong()
Parses a hexadecimal long value from the input stream.
|
default void |
parseUtf8(@NotNull Appendable sb,
boolean utf,
int length)
Parses a UTF-8 string from the input stream into the provided Appendable.
|
default void |
parseUtf8(@NotNull Appendable sb,
int encodedLength)
Parses a UTF-8 string from the input stream into the provided Appendable.
|
int |
peekUnsignedByte()
Peeks (reads without moving the read pointer) the next unsigned byte from the input stream.
|
default byte |
rawReadByte()
Reads a raw byte value from the input stream.
|
default int |
rawReadInt()
Reads a 32-bit integer value from the input stream without performing boundary checks.
|
default long |
rawReadLong()
Reads a 64-bit long value from the input stream without performing boundary checks.
|
default int |
read(byte[] bytes)
Reads the input stream into the provided byte array.
|
default 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.
|
default void |
read(@NotNull ByteBuffer buffer)
Reads the input stream into the provided ByteBuffer.
|
default void |
read(@NotNull Bytes<?> bytes)
Transfers as many bytes as possible from the input stream into the provided Bytes object.
|
default void |
read(@NotNull Bytes<?> bytes,
int length)
Transfers the specified number of bytes from the input stream into the provided Bytes object.
|
default 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.
|
default @Nullable String |
read8bit()
Reads an 8-bit encoded string from the input stream.
|
default boolean |
read8bit(@NotNull Bytes<?> b)
Reads an 8-bit encoded string from the input stream and appends it to the provided Bytes.
|
default boolean |
read8bit(@NotNull StringBuilder sb)
Reads an 8-bit encoded string from the input stream and appends it to the provided StringBuilder.
|
default @NotNull BigDecimal |
readBigDecimal()
Creates and returns a new BigDecimal representing the contents of this Bytes object.
|
default @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. |
default boolean |
readBoolean()
Reads a boolean value from the input stream.
|
byte |
readByte()
Reads a byte value from the input stream.
|
default char |
readChar()
Reads a character value from the input stream.
|
double |
readDouble()
Reads a 64-bit floating-point number from the input stream.
|
default <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.
|
default void |
readHistogram(@NotNull net.openhft.chronicle.core.util.Histogram histogram)
Reads data from the input stream into the provided Histogram.
|
default long |
readIncompleteLong() |
int |
readInt()
Reads a 32-bit integer value from the input stream.
|
default int |
readInt24()
Reads a 24-bit signed integer value from the input stream.
|
default long |
readLimit()
If the resource is closed, the returned value is unspecified.
|
S |
readLimit(long limit)
Sets the read limit of this StreamingDataInput.
|
default S |
readLimitToCapacity()
Sets the read limit of this StreamingDataInput to its capacity.
|
long |
readLong()
Reads a 64-bit long value from the input stream.
|
default long |
readPosition()
Returns the read position.
|
S |
readPosition(long position)
Sets the read position of this StreamingDataInput.
|
default long |
readPositionForHeader(boolean skipPadding)
Obtains the current read position, optionally skipping padding bytes if specified.
|
default S |
readPositionRemaining(long position,
long remaining)
Sets the read position and limit of this StreamingDataInput based on the specified position and remaining values.
|
default S |
readPositionUnlimited(long position)
Sets the read position of this StreamingDataInput without limiting it to the current read limit.
|
default 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.
|
S |
readSkip(long bytesToSkip)
Skips the specified number of bytes by advancing the read position.
|
default long |
readStopBit()
Reads a variable-length integer encoded using the stop bit encoding.
|
default char |
readStopBitChar()
Reads a variable-length character encoded using the stop bit encoding.
|
default double |
readStopBitDecimal()
Reads a decimal number represented as a variable-length double and scale encoded using the stop bit encoding.
|
default 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.
|
default long |
readUnsignedInt()
Reads a 32-bit value from the input stream and converts it to an unsigned integer by masking the sign bit.
|
default int |
readUnsignedInt24()
Reads a 24-bit unsigned integer value from the input stream.
|
default int |
readUnsignedShort()
Reads a 16-bit value from the input stream and converts it to an unsigned short by masking the sign bit.
|
default @Nullable String |
readUtf8()
Reads a UTF-8 encoded string from the input stream.
|
default boolean |
readUtf8(@NotNull Bytes<?> sb)
Reads a UTF-8 encoded string from the input stream and appends it to the provided Bytes.
|
default <C extends Appendable & CharSequence> |
readUtf8(C sb)
Reads a UTF-8 encoded string from the input stream and appends it to the provided appendable.
|
default boolean |
readUtf8(@NotNull StringBuilder sb)
Reads a UTF-8 encoded string from the input stream and appends it to the provided StringBuilder.
|
int |
readVolatileInt()
Reads a volatile (concurrently mutable) integer value from the input stream.
|
long |
readVolatileLong()
Reads a volatile (concurrently mutable) long value from the input stream.
|
default void |
readWithLength(@NotNull Bytes<?> bytes)
Reads data from the input stream with specified length into the provided Bytes.
|
default void |
readWithLength(long length,
@NotNull net.openhft.chronicle.core.util.ThrowingConsumer<S,net.openhft.chronicle.core.io.IORuntimeException> bytesConsumer)
Perform a set of actions within a temporary bounds mode.
|
default void |
readWithLength0(long length,
@NotNull net.openhft.chronicle.core.util.ThrowingConsumerNonCapturing<S,net.openhft.chronicle.core.io.IORuntimeException,BytesOut> bytesConsumer,
StringBuilder sb,
BytesOut<?> toBytes)
Perform a set of actions within a temporary bounds mode.
|
default long |
realCapacity() |
default long |
realReadRemaining()
Calculates the number of bytes that can be safely read directly.
|
default long |
realWriteRemaining()
Calculates the number of bytes remaining that can be written from the current write position with resizing.
|
boolean |
sharedMemory()
Checks if the Bytes use shared memory.
|
default long |
start() |
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.
|
default S |
unsafeRead(long address,
int length)
Reads data from the input stream into the memory at the provided address.
|
default void |
unsafeReadObject(@NotNull Object o,
int length)
Reads data from the input stream into the provided object.
|
default void |
unsafeReadObject(@NotNull Object o,
int offset,
int length)
Reads data from the input stream into the provided object, starting from the given offset.
|
default long |
writeLimit()
Retrieves the maximum writable position within the buffer.
|
default long |
writePosition()
Returns the write position.
|
default long |
writeRemaining()
Calculates the number of bytes remaining that can be written from the current write position.
|
clear
@NotNull S readPosition(long position) throws BufferUnderflowException, IllegalStateException
position
- the new read position, must be non-negativeBufferUnderflowException
- if the new position is greater than the limitIllegalStateException
- if a required state for this operation is not met@NotNull default S readPositionUnlimited(long position) throws BufferUnderflowException, IllegalStateException
position
- the new read position, must be non-negativeBufferUnderflowException
- if the new position is greater than the capacityIllegalStateException
- if a required state for this operation is not met@NotNull default S readPositionRemaining(long position, long remaining) throws BufferUnderflowException, IllegalStateException
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 limitIllegalStateException
- if a required state for this operation is not met@NotNull S readLimit(long limit) throws BufferUnderflowException
limit
- the new read limit, must be non-negativeBufferUnderflowException
- if the new limit is less than the read positiondefault S readLimitToCapacity() throws BufferUnderflowException
BufferUnderflowException
- if the capacity is less than the read position@NotNull S readSkip(long bytesToSkip) throws BufferUnderflowException, IllegalStateException
bytesToSkip
- the number of bytes to skipBufferUnderflowException
- if the new read position is outside the limits of the data sourceIllegalStateException
- if a required state for this operation is not metdefault long readPositionForHeader(boolean skipPadding)
skipPadding
- if true, aligns the read position to a 4-byte boundary by skipping padding bytesvoid uncheckedReadSkipOne()
void uncheckedReadSkipBackOne()
default void readWithLength0(long length, @NotNull @NotNull net.openhft.chronicle.core.util.ThrowingConsumerNonCapturing<S,net.openhft.chronicle.core.io.IORuntimeException,BytesOut> bytesConsumer, StringBuilder sb, BytesOut<?> toBytes) throws BufferUnderflowException, net.openhft.chronicle.core.io.IORuntimeException, IllegalStateException
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 errorIllegalStateException
- if a required state for this operation is not metdefault void readWithLength(long length, @NotNull @NotNull net.openhft.chronicle.core.util.ThrowingConsumer<S,net.openhft.chronicle.core.io.IORuntimeException> bytesConsumer) throws BufferUnderflowException, net.openhft.chronicle.core.io.IORuntimeException, IllegalStateException
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 errorIllegalStateException
- if a required state for this operation is not met@NotNull default @NotNull InputStream inputStream()
default long readStopBit() throws net.openhft.chronicle.core.io.IORuntimeException, IllegalStateException, BufferUnderflowException
BytesInternal.readStopBit(this)
.net.openhft.chronicle.core.io.IORuntimeException
- if an I/O error occursIllegalStateException
- if a required state for this operation is not metBufferUnderflowException
- if there's not enough data to readdefault char readStopBitChar() throws net.openhft.chronicle.core.io.IORuntimeException, IllegalStateException, BufferUnderflowException
BytesInternal.readStopBitChar(this)
.net.openhft.chronicle.core.io.IORuntimeException
- if an I/O error occursIllegalStateException
- if a required state for this operation is not metBufferUnderflowException
- if there's not enough data to readdefault double readStopBitDouble() throws IllegalStateException
BytesInternal.readStopBitDouble(this)
.IllegalStateException
- if a required state for this operation is not metdefault double readStopBitDecimal() throws IllegalStateException, BufferUnderflowException
IllegalStateException
- if a required state for this operation is not metBufferUnderflowException
- if there's not enough data to readdefault boolean readBoolean() throws IllegalStateException
BytesUtil.byteToBoolean(b)
.IllegalStateException
- if a required state for this operation is not metbyte readByte() throws IllegalStateException
IllegalStateException
- if a required state for this operation is not metdefault byte rawReadByte() throws IllegalStateException
readByte()
is that the latter might perform additional processing or checks.IllegalStateException
- if a required state for this operation is not metdefault char readChar() throws IllegalStateException, BufferUnderflowException
IllegalStateException
- if a required state for this operation is not metBufferUnderflowException
- if there's not enough data to readint readUnsignedByte() throws IllegalStateException
IllegalStateException
- if a required state for this operation is not metint uncheckedReadUnsignedByte()
short readShort() throws BufferUnderflowException, IllegalStateException
BufferUnderflowException
- if there's not enough data to readIllegalStateException
- if a required state for this operation is not metdefault int readUnsignedShort() throws BufferUnderflowException, IllegalStateException
BufferUnderflowException
- if there's not enough data to readIllegalStateException
- if a required state for this operation is not metdefault int readInt24() throws BufferUnderflowException, IllegalStateException
BufferUnderflowException
- if there's not enough data to readIllegalStateException
- if a required state for this operation is not metdefault int readUnsignedInt24() throws BufferUnderflowException, IllegalStateException
BufferUnderflowException
- if there's not enough data to readIllegalStateException
- if a required state for this operation is not metint readInt() throws BufferUnderflowException, IllegalStateException
BufferUnderflowException
- if there's not enough data to readIllegalStateException
- if a required state for this operation is not metdefault int rawReadInt() throws BufferUnderflowException, IllegalStateException
BufferUnderflowException
- if there's not enough data to readIllegalStateException
- if a required state for this operation is not metdefault long readUnsignedInt() throws BufferUnderflowException, IllegalStateException
BufferUnderflowException
- if there's not enough data to readIllegalStateException
- if a required state for this operation is not metlong readLong() throws BufferUnderflowException, IllegalStateException
BufferUnderflowException
- if there's not enough data to readIllegalStateException
- if a required state for this operation is not metdefault long rawReadLong() throws BufferUnderflowException, IllegalStateException
BufferUnderflowException
- if there's not enough data to readIllegalStateException
- if a required state for this operation is not metdefault long readIncompleteLong() throws IllegalStateException
IllegalStateException
- if releasedfloat readFloat() throws BufferUnderflowException, IllegalStateException
BufferUnderflowException
- if there's not enough data to readIllegalStateException
- if a required state for this operation is not metdouble readDouble() throws BufferUnderflowException, IllegalStateException
BufferUnderflowException
- if there's not enough data to readIllegalStateException
- if a required state for this operation is not met@Nullable default @Nullable String readUtf8() throws BufferUnderflowException, net.openhft.chronicle.core.io.IORuntimeException, IllegalStateException, ArithmeticException
null
values and
utilizes stop bit encoding for length, saving one byte for strings shorter than 128 characters.null
if writeUtf8(null)
was calledBufferUnderflowException
- if there's not enough data to readnet.openhft.chronicle.core.io.IORuntimeException
- if an IO error occursIllegalStateException
- if a required state for this operation is not metArithmeticException
- if numeric overflow or underflow occurs@Nullable default @Nullable String read8bit() throws net.openhft.chronicle.core.io.IORuntimeException, BufferUnderflowException, IllegalStateException, ArithmeticException
null
if write8bit(null)
was calledBufferUnderflowException
- if there's not enough data to readnet.openhft.chronicle.core.io.IORuntimeException
- if an IO error occursIllegalStateException
- if a required state for this operation is not metArithmeticException
- if numeric overflow or underflow occursdefault <C extends Appendable & CharSequence> boolean readUtf8(@NotNull C sb) throws net.openhft.chronicle.core.io.IORuntimeException, BufferUnderflowException, ArithmeticException, IllegalStateException, IllegalArgumentException
readUtf8()
, except it populates a provided appendable instead of creating a new string.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 occursBufferUnderflowException
- if there's not enough data to readArithmeticException
- if numeric overflow or underflow occursIllegalStateException
- if a required state for this operation is not metIllegalArgumentException
- if the appendable does not allow setting lengthdefault boolean readUtf8(@NotNull @NotNull Bytes<?> sb) throws net.openhft.chronicle.core.io.IORuntimeException, BufferUnderflowException, ArithmeticException, IllegalStateException
readUtf8()
, except it populates a provided Bytes instance instead of creating a new string.sb
- the Bytes instance 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 occursIllegalStateException
- if a required state for this operation is not metdefault boolean readUtf8(@NotNull @NotNull StringBuilder sb) throws net.openhft.chronicle.core.io.IORuntimeException, BufferUnderflowException, ArithmeticException, IllegalStateException
readUtf8()
, except it populates a provided StringBuilder instead of creating a new string.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 occursIllegalStateException
- if a required state for this operation is not metdefault boolean read8bit(@NotNull @NotNull Bytes<?> b) throws BufferUnderflowException, IllegalStateException, ArithmeticException, BufferOverflowException
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 readIllegalStateException
- if a required state for this operation is not metArithmeticException
- if numeric overflow or underflow occursBufferOverflowException
- if the buffer is fulldefault boolean read8bit(@NotNull @NotNull StringBuilder sb) throws net.openhft.chronicle.core.io.IORuntimeException, BufferUnderflowException, ArithmeticException, IllegalStateException
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 occursIllegalStateException
- if a required state for this operation is not metdefault int read(byte[] bytes) throws BufferUnderflowException, IllegalStateException
bytes
- the byte array to fill with the read dataBufferUnderflowException
- if there's not enough data to readIllegalStateException
- if a required state for this operation is not metdefault int read(byte[] bytes, int off, int len) throws BufferUnderflowException, IllegalStateException
bytes
- the byte array to fill with the read dataoff
- the start offset in the byte arraylen
- the maximum number of bytes to readBufferUnderflowException
- if there's not enough data to readIllegalStateException
- if a required state for this operation is not metdefault int read(char[] bytes, int off, int len) throws IllegalStateException
bytes
- the char array to fill with the read dataoff
- the start offset in the char arraylen
- the maximum number of chars to readIllegalStateException
- if a required state for this operation is not metdefault void read(@NotNull @NotNull ByteBuffer buffer) throws IllegalStateException
buffer
- the ByteBuffer to fill with the read dataIllegalStateException
- if a required state for this operation is not metdefault void read(@NotNull @NotNull Bytes<?> bytes)
bytes
- the Bytes object to fill with the read dataStreamingDataOutput.write(BytesStore)
default void read(@NotNull @NotNull Bytes<?> bytes, int length) throws BufferUnderflowException, BufferOverflowException, IllegalStateException
bytes
- the Bytes object to fill with the read datalength
- the number of bytes to readBufferUnderflowException
- if there's not enough data to readBufferOverflowException
- if there's not enough space in the provided Bytes objectIllegalStateException
- if a required state for this operation is not metdefault void unsafeReadObject(@NotNull @NotNull Object o, int length) throws BufferUnderflowException, IllegalStateException
o
- the object to fill with the read datalength
- the number of bytes to readBufferUnderflowException
- if there's not enough data to readIllegalStateException
- if a required state for this operation is not metdefault void unsafeReadObject(@NotNull @NotNull Object o, int offset, int length) throws BufferUnderflowException, IllegalStateException
o
- the object to fill with the read dataoffset
- the start offset in the objectlength
- the number of bytes to readBufferUnderflowException
- if there's not enough data to readIllegalStateException
- if a required state for this operation is not metdefault S unsafeRead(long address, int length)
address
- the address of the memory to fill with the read datalength
- the number of bytes to readint readVolatileInt() throws BufferUnderflowException, IllegalStateException
BufferUnderflowException
- if there's not enough data to readIllegalStateException
- if a required state for this operation is not metlong readVolatileLong() throws BufferUnderflowException, IllegalStateException
BufferUnderflowException
- if there's not enough data to readIllegalStateException
- if a required state for this operation is not metint peekUnsignedByte() throws IllegalStateException
IllegalStateException
- if a required state for this operation is not met@NotNull default <E extends Enum<E>> E readEnum(@NotNull @NotNull Class<E> eClass) throws net.openhft.chronicle.core.io.IORuntimeException, BufferUnderflowException, ArithmeticException, IllegalStateException, BufferOverflowException
eClass
- the class of the Enumnet.openhft.chronicle.core.io.IORuntimeException
- if an I/O error occursBufferUnderflowException
- if there's not enough data to readArithmeticException
- if the number format is invalidIllegalStateException
- if a required state for this operation is not metBufferOverflowException
- if there's not enough space in the bufferdefault void parseUtf8(@NotNull @NotNull Appendable sb, int encodedLength) throws IllegalArgumentException, BufferUnderflowException, UTFDataFormatRuntimeException, IllegalStateException
sb
- the Appendable to fill with the parsed stringencodedLength
- the length of the UTF-8 encoded data in bytesIllegalArgumentException
- if an illegal argument is providedBufferUnderflowException
- if there's not enough data to readUTFDataFormatRuntimeException
- if the string is not valid UTF-8IllegalStateException
- if a required state for this operation is not metdefault void parseUtf8(@NotNull @NotNull Appendable sb, boolean utf, int length) throws IllegalArgumentException, BufferUnderflowException, UTFDataFormatRuntimeException, IllegalStateException
sb
- the Appendable to fill with the parsed stringutf
- true if the length is the UTF-8 encoded length, false if the length is the length of charslength
- the maximum number of bytes to readIllegalArgumentException
- if an illegal argument is providedBufferUnderflowException
- if there's not enough data to readUTFDataFormatRuntimeException
- if the string is not valid UTF-8IllegalStateException
- if a required state for this operation is not metdefault long parseHexLong() throws BufferUnderflowException, IllegalStateException
BufferUnderflowException
- if there's not enough data to readIllegalStateException
- if a required state for this operation is not metvoid copyTo(@NotNull @NotNull OutputStream out) throws IOException, IllegalStateException
out
- the OutputStream to copy the data toIOException
- if an I/O error occursIllegalStateException
- if a required state for this operation is not metlong copyTo(@NotNull @NotNull BytesStore to) throws IllegalStateException
to
- the BytesStore to copy the data toIllegalStateException
- if a required state for this operation is not metdefault void readHistogram(@NotNull @NotNull net.openhft.chronicle.core.util.Histogram histogram) throws BufferUnderflowException, IllegalStateException, ArithmeticException
histogram
- the Histogram to fill with dataBufferUnderflowException
- if there's not enough data to readIllegalStateException
- if a required state for this operation is not metArithmeticException
- if the number format is invaliddefault void readWithLength(@NotNull @NotNull Bytes<?> bytes) throws ArithmeticException, BufferUnderflowException, BufferOverflowException, IllegalStateException
bytes
- the Bytes to fill with dataArithmeticException
- if the number format is invalidBufferUnderflowException
- if there's not enough data to readBufferOverflowException
- if there's not enough space in the bufferIllegalStateException
- if a required state for this operation is not metvoid lenient(boolean lenient)
false
and empty string.lenient
- if true, return nothing rather than error.boolean lenient()
@NotNull default @NotNull BigDecimal readBigDecimal() throws ArithmeticException, BufferUnderflowException, IllegalStateException
If this Byte object is empty, an object equal to BigDecimal.ZERO
is returned.
ArithmeticException
- if the content of this Bytes object could not be successfully convertedBufferUnderflowException
- if the content of this Bytes object is insufficient to be successfully convertedIllegalStateException
- if this Bytes object was previously released@NotNull default @NotNull BigInteger readBigInteger() throws ArithmeticException, BufferUnderflowException, IllegalStateException
BigInteger.ZERO
if this Bytes object is empty.ArithmeticException
- if the content of this Bytes object could not be successfully convertedBufferUnderflowException
- if the content of this Bytes object is insufficient to be successfully convertedIllegalStateException
- if this Bytes object was previously releaseddefault long start()
default long capacity()
default long realCapacity()
default long readPosition()
The read position is start() <= readPosition() && readPosition() <= readLimit() && readPosition < safeLimit()
If the resource is closed, the returned value is unspecified.
default long writePosition()
The write position is readPosition() <= writePosition() && writePosition() <= writeLimit()
If the resource is closed, the returned value is unspecified.
default 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.default long readRemaining()
If the resource is closed, the returned value is unspecified.
default long realReadRemaining()
If the resource is closed, the returned value is unspecified.
default long writeRemaining()
If the resource is closed, the returned value is unspecified.
default long realWriteRemaining()
If the resource is closed, the returned value is unspecified.
default long readLimit()
If the resource is closed, the returned value is unspecified.
default long writeLimit()
If the resource is closed, the returned value is unspecified.
long addressForRead(long offset) throws UnsupportedOperationException, BufferUnderflowException, IllegalStateException
offset
- within this buffer. addressForRead(start()) is the actual addressForRead of the first byte.UnsupportedOperationException
- if the underlying buffer is on the heapBufferUnderflowException
- if the offset is before the start() or the after the capacity()IllegalStateException
- if the buffer has been closed.default long addressForRead(long offset, int buffer) throws UnsupportedOperationException, BufferUnderflowException, IllegalStateException
offset
- The offset within this buffer.buffer
- The buffer index.UnsupportedOperationException
- if the underlying buffer is on the heap.BufferUnderflowException
- if the offset is before the start or after the capacity.IllegalStateException
- if the buffer has been closed.long addressForWrite(long offset) throws UnsupportedOperationException, BufferOverflowException, IllegalStateException
offset
- within this buffer. addressForRead(start()) is the actual addressForRead of the first byte.UnsupportedOperationException
- if the underlying buffer is on the heapBufferOverflowException
- if the offset is before the start() or the after the capacity()IllegalStateException
long addressForWritePosition() throws UnsupportedOperationException, BufferOverflowException, IllegalStateException
UnsupportedOperationException
- if the underlying buffer is on the heap.BufferOverflowException
- if the current write position is before the start or after the capacity.IllegalStateException
- if the buffer state doesn't allow the operation.default ByteOrder byteOrder()
@NotNull @NotNull Bytes<?> bytesForRead() throws IllegalStateException
IllegalStateException
- if the buffer state doesn't allow the operation.@NotNull @NotNull Bytes<?> bytesForWrite() throws IllegalStateException
IllegalStateException
- if the buffer state doesn't allow the operation.boolean sharedMemory()
boolean isDirectMemory()
Copyright © 2023. All rights reserved.