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.
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, compareUtf8, copyTo, copyTo, 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, 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, net.openhft.chronicle.core.io.InvalidMarshallableException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
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.net.openhft.chronicle.core.io.InvalidMarshallableException
- If the object cannot be read due to invalid data.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.default <T> T readObject(@NotNull @NotNull Class<T> componentType0) throws BufferUnderflowException, ArithmeticException, BufferOverflowException, net.openhft.chronicle.core.io.InvalidMarshallableException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
componentType0
- the class of the object to be read.BufferUnderflowException
- If there are not enough bytes left to 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 way.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, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
offset
- within this buffer. addressForRead(start()) is the actual addressForRead of the first byte.UnsupportedOperationException
- If the underlying buffer is on the heapBufferUnderflowException
- If the offset is before the start() or the after the capacity()net.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException
- If this resource was accessed by multiple threads in an unsafe waydefault long addressForRead(long offset, int buffer) throws UnsupportedOperationException, BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
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.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 waylong addressForWrite(long offset) throws UnsupportedOperationException, BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
offset
- within this buffer. addressForRead(start()) is the actual addressForRead of the first byte.UnsupportedOperationException
- If the underlying buffer is on the heapBufferOverflowException
- If the offset is before the start() or the after the capacity()net.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException
- If this resource was accessed by multiple threads in an unsafe waylong addressForWritePosition() throws UnsupportedOperationException, BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
UnsupportedOperationException
- If the underlying buffer is on the heap.BufferOverflowException
- If the current write position is before the start or after the capacity.net.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException
- If this resource was accessed by multiple threads in an unsafe waydefault ByteOrder byteOrder()
@NotNull @NotNull Bytes<?> bytesForRead() throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
net.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException
- If this resource was accessed by multiple threads in an unsafe way@NotNull @NotNull Bytes<?> bytesForWrite() throws net.openhft.chronicle.core.io.ClosedIllegalStateException
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 wayboolean sharedMemory()
boolean isDirectMemory()
Copyright © 2023. All rights reserved.