public interface StreamingDataInput<S extends StreamingDataInput<S>> extends StreamingCommon<S>
Modifier and Type | Method and Description |
---|---|
long |
addressForRead(long offset)
Obtain the underlying addressForRead.
|
default long |
addressForRead(long offset,
int buffer) |
long |
addressForWrite(long offset)
Obtain the underlying addressForRead.
|
long |
addressForWritePosition() |
default ByteOrder |
byteOrder() |
@NotNull Bytes<?> |
bytesForRead() |
@NotNull Bytes<?> |
bytesForWrite() |
default long |
capacity() |
default boolean |
compareAndSwapDouble(long offset,
double expected,
double value)
Perform a 64-bit double CAS at a given offset.
|
default boolean |
compareAndSwapFloat(long offset,
float expected,
float value)
Perform a 32-bit float CAS at a given offset.
|
boolean |
compareAndSwapInt(long offset,
int expected,
int value)
Perform a 32-bit CAS at a given offset.
|
boolean |
compareAndSwapLong(long offset,
long expected,
long value)
Perform a 64-bit CAS at a given offset.
|
long |
copyTo(@NotNull BytesStore to) |
void |
copyTo(@NotNull OutputStream out) |
default @NotNull InputStream |
inputStream() |
boolean |
isDirectMemory() |
default long |
lengthWritten(long startPosition)
Typically this calculates the difference however for HexDumpBytes it's not as simple.
|
boolean |
lenient() |
void |
lenient(boolean lenient)
When there is no more data to read, return zero,
false and empty string. |
default long |
parseHexLong() |
default void |
parseUtf8(@NotNull Appendable sb,
boolean utf,
int length)
parse a UTF8 string.
|
default void |
parseUtf8(@NotNull Appendable sb,
int encodedLength)
parse a UTF8 string.
|
int |
peekUnsignedByte() |
default byte |
rawReadByte() |
default int |
rawReadInt() |
default long |
rawReadLong() |
default int |
read(byte[] bytes) |
default int |
read(byte[] bytes,
int off,
int len) |
default void |
read(@NotNull ByteBuffer buffer) |
default void |
read(@NotNull Bytes<?> bytes)
Transfer as many bytes as possible.
|
default void |
read(@NotNull Bytes<?> bytes,
int length) |
default int |
read(char[] bytes,
int off,
int len) |
default @Nullable String |
read8bit() |
default boolean |
read8bit(@NotNull Bytes<?> b) |
default boolean |
read8bit(@NotNull StringBuilder sb) |
default boolean |
readBoolean() |
byte |
readByte() |
default char |
readChar() |
double |
readDouble() |
default <E extends Enum<E>> |
readEnum(@NotNull Class<E> eClass) |
float |
readFloat() |
default void |
readHistogram(@NotNull net.openhft.chronicle.core.util.Histogram histogram) |
default long |
readIncompleteLong() |
int |
readInt() |
default int |
readInt24() |
default long |
readLimit()
If the resource is closed, the returned value is unspecified.
|
S |
readLimit(long limit) |
default S |
readLimitToCapacity() |
long |
readLong() |
default long |
readPosition()
Returns the read position.
|
S |
readPosition(long position) |
default long |
readPositionForHeader(boolean skipPadding)
obtain the readPosition skipping any padding needed for a header.
|
default S |
readPositionRemaining(long position,
long remaining) |
default S |
readPositionUnlimited(long position) |
default long |
readRemaining()
Returns the remaining bytes that can be read.
|
short |
readShort() |
S |
readSkip(long bytesToSkip)
Skip a number of bytes by moving the readPosition.
|
default long |
readStopBit() |
default char |
readStopBitChar() |
default double |
readStopBitDecimal() |
default double |
readStopBitDouble() |
int |
readUnsignedByte() |
default long |
readUnsignedInt() |
default int |
readUnsignedInt24() |
default int |
readUnsignedShort() |
default @Nullable String |
readUtf8()
The same as readUTF() except the length is stop bit encoded.
|
default boolean |
readUtf8(@NotNull Bytes<?> sb) |
default <C extends Appendable & CharSequence> |
readUtf8(C sb)
The same as readUtf8() except the chars are copied to a truncated StringBuilder.
|
default boolean |
readUtf8(@NotNull StringBuilder sb) |
int |
readVolatileInt() |
long |
readVolatileLong() |
default void |
readWithLength(@NotNull Bytes<?> 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 with 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 with a temporary bounds mode.
|
default long |
realCapacity() |
default long |
realReadRemaining()
If the resource is closed, the returned value is unspecified.
|
default long |
realWriteRemaining()
If the resource is closed, the returned value is unspecified.
|
boolean |
sharedMemory() |
default long |
start() |
void |
testAndSetInt(long offset,
int expected,
int value) |
void |
uncheckedReadSkipBackOne()
Read skip -1 when you are sure this is safe.
|
void |
uncheckedReadSkipOne()
Read skip 1 when you are sure this is safe.
|
int |
uncheckedReadUnsignedByte() |
default S |
unsafeRead(long address,
int length) |
default void |
unsafeReadObject(@NotNull Object o,
int length) |
default void |
unsafeReadObject(@NotNull Object o,
int offset,
int length) |
default long |
writeLimit()
Returns the write limit.
|
default long |
writePosition()
Returns the write position.
|
default long |
writeRemaining()
If the resource is closed, the returned value is unspecified.
|
clear
@NotNull S readPosition(long position) throws BufferUnderflowException, IllegalStateException
@NotNull default S readPositionUnlimited(long position) throws BufferUnderflowException, IllegalStateException
@NotNull default S readPositionRemaining(long position, long remaining) throws BufferUnderflowException, IllegalStateException
@NotNull S readLimit(long limit) throws BufferUnderflowException
BufferUnderflowException
default S readLimitToCapacity() throws BufferUnderflowException
BufferUnderflowException
@NotNull S readSkip(long bytesToSkip) throws BufferUnderflowException, IllegalStateException
bytesToSkip
- bytes to skip.BufferUnderflowException
- if the offset is outside the limits of the BytesIllegalStateException
default long readPositionForHeader(boolean skipPadding)
skipPadding
- optional aligning to 4 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
BufferUnderflowException
net.openhft.chronicle.core.io.IORuntimeException
IllegalStateException
default 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
BufferUnderflowException
net.openhft.chronicle.core.io.IORuntimeException
IllegalStateException
@NotNull default @NotNull InputStream inputStream()
default long readStopBit() throws net.openhft.chronicle.core.io.IORuntimeException, IllegalStateException, BufferUnderflowException
net.openhft.chronicle.core.io.IORuntimeException
IllegalStateException
BufferUnderflowException
default char readStopBitChar() throws net.openhft.chronicle.core.io.IORuntimeException, IllegalStateException, BufferUnderflowException
net.openhft.chronicle.core.io.IORuntimeException
IllegalStateException
BufferUnderflowException
default double readStopBitDouble() throws IllegalStateException
IllegalStateException
default double readStopBitDecimal() throws IllegalStateException, BufferUnderflowException
default boolean readBoolean() throws IllegalStateException
IllegalStateException
byte readByte() throws IllegalStateException
IllegalStateException
default byte rawReadByte() throws IllegalStateException
IllegalStateException
default char readChar() throws IllegalStateException, BufferUnderflowException
int readUnsignedByte() throws IllegalStateException
IllegalStateException
int uncheckedReadUnsignedByte()
short readShort() throws BufferUnderflowException, IllegalStateException
default int readUnsignedShort() throws BufferUnderflowException, IllegalStateException
default int readInt24() throws BufferUnderflowException, IllegalStateException
default int readUnsignedInt24() throws BufferUnderflowException, IllegalStateException
int readInt() throws BufferUnderflowException, IllegalStateException
default int rawReadInt() throws BufferUnderflowException, IllegalStateException
default long readUnsignedInt() throws BufferUnderflowException, IllegalStateException
long readLong() throws BufferUnderflowException, IllegalStateException
default long rawReadLong() throws BufferUnderflowException, IllegalStateException
default long readIncompleteLong() throws IllegalStateException
IllegalStateException
float readFloat() throws BufferUnderflowException, IllegalStateException
double readDouble() throws BufferUnderflowException, IllegalStateException
@Nullable default @Nullable String readUtf8() throws BufferUnderflowException, net.openhft.chronicle.core.io.IORuntimeException, IllegalStateException, ArithmeticException
null
values are also supportednull
if writeUtf8(null)
was calledBufferUnderflowException
net.openhft.chronicle.core.io.IORuntimeException
IllegalStateException
ArithmeticException
@Nullable default @Nullable String read8bit() throws net.openhft.chronicle.core.io.IORuntimeException, BufferUnderflowException, IllegalStateException, ArithmeticException
net.openhft.chronicle.core.io.IORuntimeException
BufferUnderflowException
IllegalStateException
ArithmeticException
default <C extends Appendable & CharSequence> boolean readUtf8(@NotNull C sb) throws net.openhft.chronicle.core.io.IORuntimeException, BufferUnderflowException, ArithmeticException, IllegalStateException, IllegalArgumentException
sb
- to copy chars totrue
if there was a String, or false
if it was null
net.openhft.chronicle.core.io.IORuntimeException
BufferUnderflowException
ArithmeticException
IllegalStateException
IllegalArgumentException
default boolean readUtf8(@NotNull @NotNull Bytes<?> sb) throws net.openhft.chronicle.core.io.IORuntimeException, BufferUnderflowException, ArithmeticException, IllegalStateException
net.openhft.chronicle.core.io.IORuntimeException
BufferUnderflowException
ArithmeticException
IllegalStateException
default boolean readUtf8(@NotNull @NotNull StringBuilder sb) throws net.openhft.chronicle.core.io.IORuntimeException, BufferUnderflowException, ArithmeticException, IllegalStateException
net.openhft.chronicle.core.io.IORuntimeException
BufferUnderflowException
ArithmeticException
IllegalStateException
default boolean read8bit(@NotNull @NotNull Bytes<?> b) throws BufferUnderflowException, IllegalStateException, ArithmeticException, BufferOverflowException
default boolean read8bit(@NotNull @NotNull StringBuilder sb) throws net.openhft.chronicle.core.io.IORuntimeException, BufferUnderflowException, ArithmeticException, IllegalStateException
net.openhft.chronicle.core.io.IORuntimeException
BufferUnderflowException
ArithmeticException
IllegalStateException
default int read(byte[] bytes) throws BufferUnderflowException, IllegalStateException
default int read(byte[] bytes, int off, int len) throws BufferUnderflowException, IllegalStateException
default int read(char[] bytes, int off, int len) throws IllegalStateException
IllegalStateException
default void read(@NotNull @NotNull ByteBuffer buffer) throws IllegalStateException
IllegalStateException
default void read(@NotNull @NotNull Bytes<?> bytes)
bytes
- to copy to.StreamingDataOutput.write(BytesStore)
default void read(@NotNull @NotNull Bytes<?> bytes, int length) throws BufferUnderflowException, BufferOverflowException, IllegalStateException
default void unsafeReadObject(@NotNull @NotNull Object o, int length) throws BufferUnderflowException, IllegalStateException
default void unsafeReadObject(@NotNull @NotNull Object o, int offset, int length) throws BufferUnderflowException, IllegalStateException
default S unsafeRead(long address, int length)
int readVolatileInt() throws BufferUnderflowException, IllegalStateException
long readVolatileLong() throws BufferUnderflowException, IllegalStateException
int peekUnsignedByte() throws IllegalStateException
IllegalStateException
@NotNull default <E extends Enum<E>> E readEnum(@NotNull @NotNull Class<E> eClass) throws net.openhft.chronicle.core.io.IORuntimeException, BufferUnderflowException, ArithmeticException, IllegalStateException, BufferOverflowException
net.openhft.chronicle.core.io.IORuntimeException
BufferUnderflowException
ArithmeticException
IllegalStateException
BufferOverflowException
default void parseUtf8(@NotNull @NotNull Appendable sb, int encodedLength) throws IllegalArgumentException, BufferUnderflowException, UTFDataFormatRuntimeException, IllegalStateException
sb
- buffer to copy intoencodedLength
- length of the UTF encoded data in bytesIllegalArgumentException
BufferUnderflowException
UTFDataFormatRuntimeException
IllegalStateException
default void parseUtf8(@NotNull @NotNull Appendable sb, boolean utf, int length) throws IllegalArgumentException, BufferUnderflowException, UTFDataFormatRuntimeException, IllegalStateException
sb
- buffer to copy intoutf
- true if the length is the UTF-8 encoded length, false if the length is the length of charslength
- to limit the read.IllegalArgumentException
BufferUnderflowException
UTFDataFormatRuntimeException
IllegalStateException
default long parseHexLong() throws BufferUnderflowException, IllegalStateException
void copyTo(@NotNull @NotNull OutputStream out) throws IOException, IllegalStateException
IOException
IllegalStateException
long copyTo(@NotNull @NotNull BytesStore to) throws IllegalStateException
IllegalStateException
default void readHistogram(@NotNull @NotNull net.openhft.chronicle.core.util.Histogram histogram) throws BufferUnderflowException, IllegalStateException, ArithmeticException
default void readWithLength(@NotNull @NotNull Bytes<?> bytes) throws ArithmeticException, BufferUnderflowException, BufferOverflowException, IllegalStateException
void lenient(boolean lenient)
false
and empty string.lenient
- if true, return nothing rather than error.boolean lenient()
default 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()
readPosition() <= writePosition() && writePosition() <= writeLimit()
If the resource is closed, the returned value is unspecified.
default long lengthWritten(long startPosition)
If the resource is closed, the returned value is unspecified.
startPosition
- to compare againstdefault 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
default long addressForRead(long offset, int buffer) throws UnsupportedOperationException, BufferUnderflowException, IllegalStateException
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
default ByteOrder byteOrder()
@NotNull @NotNull Bytes<?> bytesForRead() throws IllegalStateException
IllegalStateException
@NotNull @NotNull Bytes<?> bytesForWrite() throws IllegalStateException
IllegalStateException
boolean compareAndSwapInt(long offset, int expected, int value) throws BufferOverflowException, IllegalStateException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
IllegalStateException
void testAndSetInt(long offset, int expected, int value) throws BufferOverflowException, IllegalStateException
boolean compareAndSwapLong(long offset, long expected, long value) throws BufferOverflowException, IllegalStateException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
IllegalStateException
default boolean compareAndSwapFloat(long offset, float expected, float value) throws BufferOverflowException, IllegalStateException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
IllegalStateException
default boolean compareAndSwapDouble(long offset, double expected, double value) throws BufferOverflowException, IllegalStateException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
IllegalStateException
boolean sharedMemory()
boolean isDirectMemory()
Copyright © 2022. All rights reserved.