U
- the type of the bytes in this input.public interface BytesIn<U> extends RandomDataInput, StreamingDataInput<Bytes<U>>, ByteStringParser<Bytes<U>>
This interface supports reading of basic data types, Strings, Enums, and BytesMarshallable objects. If an unsupported class is specified in the readObject method, an UnsupportedOperationException is thrown.
The classes implementing this interface should handle any necessary synchronization.
charToString
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 @NotNull MethodReader |
bytesMethodReader(Object... objects)
Creates a MethodReader for reading methods serialized to the MarshallableOut.
|
default @NotNull BytesMethodReaderBuilder |
bytesMethodReaderBuilder()
Creates a builder for the MethodReader.
|
default long |
capacity() |
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.
|
default long |
readLimit()
If the resource is closed, the returned value is unspecified.
|
<T extends ReadBytesMarshallable> |
readMarshallableLength16(@NotNull Class<T> tClass,
T using)
Reads a Marshallable object of a specific class from this BytesIn.
|
default <T> T |
readObject(@NotNull Class<T> componentType0)
Reads an object of a specific class from this BytesIn.
|
default long |
readPosition()
Returns the read position.
|
default long |
readRemaining()
Calculates the number of bytes remaining that can be read from the current read position.
|
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() |
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.
|
addAndGetDouble, addAndGetFloat, addAndGetInt, addAndGetLong, canReadDirect, canReadDirect, compareAndSwapDouble, compareAndSwapFloat, compareAndSwapInt, compareAndSwapLong, compareUtf8, copyTo, copyTo, createCharToString, fastHash, findByte, nativeRead, parseLong, peekUnsignedByte, peekVolatileInt, printable, read, readBoolean, readByte, readDouble, readFloat, readIncompleteLong, readInt, readLong, readShort, readUnsignedByte, readUnsignedInt, readUnsignedInt24, readUnsignedShort, readUtf8, readUtf8Limited, readUtf8Limited, readVolatileByte, readVolatileDouble, readVolatileFloat, readVolatileInt, readVolatileLong, readVolatileShort, realCapacity, subBytes, testAndSetInt, toByteArray, toTemporaryDirectByteBuffer
lastDecimalPlaces, lastDecimalPlaces, lastNumberHadDigits, lastNumberHadDigits, parse8bit, parse8bit, parse8bit, parse8bit, parse8bit, parseBigDecimal, parseBoolean, parseBoolean, parseDouble, parseFlexibleLong, parseFloat, parseInt, parseLong, parseLongDecimal, parseUtf8, parseUtf8, parseUtf8, reader, skipTo
copyTo, copyTo, inputStream, lenient, lenient, parseHexLong, parseUtf8, parseUtf8, peekUnsignedByte, rawReadByte, rawReadInt, rawReadLong, read, read, read, read, read, read, read8bit, read8bit, read8bit, readBigDecimal, readBigInteger, readBoolean, readByte, readChar, readDouble, readEnum, readFloat, readHistogram, readIncompleteLong, readInt, readInt24, readLimit, readLimitToCapacity, readLong, readPosition, readPositionForHeader, readPositionRemaining, readPositionUnlimited, readShort, readSkip, readStopBit, readStopBitChar, readStopBitDecimal, readStopBitDouble, readUnsignedByte, readUnsignedInt, readUnsignedInt24, readUnsignedShort, readUtf8, readUtf8, readUtf8, readUtf8, readVolatileInt, readVolatileLong, readWithLength, readWithLength, readWithLength0, uncheckedReadSkipBackOne, uncheckedReadSkipOne, uncheckedReadUnsignedByte, unsafeRead, unsafeReadObject, unsafeReadObject
clear
@NotNull default @NotNull MethodReader bytesMethodReader(@NotNull Object... objects)
objects
- which implement the methods serialized to the MarshallableOut.@NotNull default @NotNull BytesMethodReaderBuilder bytesMethodReaderBuilder()
<T extends ReadBytesMarshallable> T readMarshallableLength16(@NotNull @NotNull Class<T> tClass, @Nullable T using) throws BufferUnderflowException, IllegalStateException, net.openhft.chronicle.core.io.InvalidMarshallableException
tClass
- the class of the Marshallable object to be read.using
- the object to be used for reading, can be null.BufferUnderflowException
- if there are not enough bytes left to read.IllegalStateException
- if there is an error in the internal state.net.openhft.chronicle.core.io.InvalidMarshallableException
- if the object cannot be read due to invalid data.default <T> T readObject(@NotNull @NotNull Class<T> componentType0) throws BufferUnderflowException, IllegalStateException, ArithmeticException, BufferOverflowException, net.openhft.chronicle.core.io.InvalidMarshallableException
componentType0
- the class of the object to be read.BufferUnderflowException
- if there are not enough bytes left to read.IllegalStateException
- if there is an error in the internal state.ArithmeticException
- if there is an arithmetic error.BufferOverflowException
- if there are too many bytes left to read.net.openhft.chronicle.core.io.InvalidMarshallableException
- if the object cannot be read due to invalid data.UnsupportedOperationException
- if an unsupported class is specified.default long start()
default long capacity()
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.