public interface WireIn extends WireCommon, MarshallableIn
| Modifier and Type | Interface and Description |
|---|---|
static class |
WireIn.HeaderType
Enumeration representing possible header types that can be read from a WireIn instance.
|
MARSHALLABLE_IN_INTERN_SIZE| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears the WireIn, effectively resetting its state.
|
void |
commentListener(Consumer<CharSequence> commentListener)
Sets a listener that gets notified whenever a comment is encountered during reading.
|
void |
consumePadding()
Consumes and discards any padding that may exist between the current read position and the next piece of meaningful data.
|
void |
copyTo(@NotNull WireOut wire)
Copies the content from the current WireIn source to the provided WireOut destination.
|
default void |
endEvent()
Marks the end of an event or method flow.
|
@NotNull ValueIn |
getValueIn()
Obtains the value associated with a field or event for more advanced use cases.
|
default boolean |
hasMetaDataPrefix()
Checks if the current position in the stream has a metadata prefix.
|
default boolean |
hasMore()
This consumes any padding before checking if readRemaining() > 0
|
default boolean |
hintReadInputOrder()
Provides a hint about the order in which the input should be read.
|
default boolean |
isEmpty()
Checks if the WireIn is empty.
|
default boolean |
isEndEvent()
Checks if the current position in the stream represents the end of an event or method flow.
|
default boolean |
isNotEmptyAfterPadding()
This consumes any padding before checking if readRemaining() > 0
|
ObjectInput |
objectInput()
Returns the ObjectInput associated with this WireIn for serialization operations.
|
default void |
rawReadData(@NotNull ReadMarshallable marshallable)
Performs a raw data read operation.
|
@NotNull ValueIn |
read()
Reads the next field if present, or returns an empty string if not present.
|
default @NotNull ValueIn |
read(String fieldName)
Reads the next field based on the provided field name.
|
@NotNull ValueIn |
read(@NotNull StringBuilder name)
Reads a specific field based on the provided field name.
|
@NotNull ValueIn |
read(@NotNull WireKey key)
Reads the next field if present.
|
default @NotNull WireIn |
readAlignTo(int alignment)
Adjusts the read position of the WireIn to align with the specified boundary.
|
default <K,V> @NotNull Map<K,V> |
readAllAsMap(Class<K> kClass,
@NotNull Class<V> vClass,
@NotNull Map<K,V> map)
Reads all available entries and populates the provided map with these entries.
|
void |
readAndSetLength(long position)
Reads and sets the length of the data or metadata at the specified position.
|
@NotNull WireIn |
readComment(@NotNull StringBuilder sb)
Reads a comment from the Wire data and appends it to the provided StringBuilder.
|
default boolean |
readDataHeader()
Consume a header if one is available.
|
@NotNull WireIn.HeaderType |
readDataHeader(boolean includeMetaData)
Attempts to read a header for data or metadata, based on the provided parameter.
|
default boolean |
readDocument(long position,
@Nullable ReadMarshallable metaDataConsumer,
@Nullable ReadMarshallable dataConsumer)
Reads a document from a specific position, consuming both its metadata and data sections.
|
default boolean |
readDocument(@Nullable ReadMarshallable metaDataConsumer,
@Nullable ReadMarshallable dataConsumer)
Reads a document, consuming both its metadata and data sections.
|
<K> K |
readEvent(Class<K> expectedClass)
Reads a field which may contain an object of any specified type.
|
default @NotNull ValueIn |
readEventName(@NotNull StringBuilder name)
Reads a field or string, ensuring the value is always read.
|
long |
readEventNumber()
Reads the next event number.
|
void |
readFirstHeader()
Reads the first header in the stream.
|
void |
readFirstHeader(long timeout,
TimeUnit timeUnit)
Reads the first header in the stream with a timeout.
|
@NotNull DocumentContext |
readingDocument()
equivalent to
readDocument(net.openhft.chronicle.wire.ReadMarshallable,
net.openhft.chronicle.wire.ReadMarshallable) but with out the use of a lambda expression |
DocumentContext |
readingDocument(long readLocation)
Provides a context for reading a document starting at a specific position.
|
String |
readingPeekYaml()
Peeks at the content in the current WireIn instance and returns it as a YAML string.
|
void |
readMetaDataHeader()
Reads the metadata header from the current position in the stream.
|
default void |
startEvent()
Marks the start of an event or method flow.
|
bytes, bytesComment, classLookup, classLookup, headerNumber, headerNumber, isBinary, newBooleanReference, newIntArrayReference, newIntReference, newLongArrayReference, newLongReference, newTwoLongReference, notCompleteIsNotPresent, notCompleteIsNotPresent, parent, parent, pauser, pauser, reset, usePadding, usePadding, useSelfDescribingMessagemethodReader, methodReaderBuilder, readBytes, readBytes, readDocument, readMap, readText, readText@NotNull default <K,V> @NotNull Map<K,V> readAllAsMap(Class<K> kClass, @NotNull @NotNull Class<V> vClass, @NotNull @NotNull Map<K,V> map) throws net.openhft.chronicle.core.io.InvalidMarshallableException
K and the value is of type V.K - The type of keys in the map.V - The type of values in the map.kClass - The class type of the key.vClass - The class type of the value.map - The map to populate with read entries.net.openhft.chronicle.core.io.InvalidMarshallableException - If there's an error in the marshalling process.void copyTo(@NotNull
@NotNull WireOut wire)
throws net.openhft.chronicle.core.io.InvalidMarshallableException
wire - The WireOut instance where the content will be copied to.net.openhft.chronicle.core.io.InvalidMarshallableException - If there's an error in the marshalling process.@NotNull @NotNull ValueIn read()
ValueIn instance.@NotNull @NotNull ValueIn read(@NotNull @NotNull WireKey key)
WireKey.key - The WireKey that should match the next field.ValueIn instance.@NotNull default @NotNull ValueIn read(String fieldName)
fieldName - The name of the field to read.ValueIn instance.long readEventNumber()
@NotNull default @NotNull ValueIn readEventName(@NotNull @NotNull StringBuilder name)
name - The StringBuilder that holds the name of the field or string.ValueIn instance.net.openhft.chronicle.core.io.IORuntimeException - If the bytes fail to be parsed.@NotNull @NotNull ValueIn read(@NotNull @NotNull StringBuilder name)
name - The name of the field to read.ValueIn instance.@Nullable <K> K readEvent(Class<K> expectedClass) throws net.openhft.chronicle.core.io.InvalidMarshallableException
K - The type of object expected.expectedClass - The class type hint of the expected object. If no hint is available, use Object.class.net.openhft.chronicle.core.io.InvalidMarshallableException - If there's an error in the marshalling process.@NotNull @NotNull ValueIn getValueIn()
readEvent(Class).ValueIn instance.ObjectInput objectInput()
@NotNull @NotNull WireIn readComment(@NotNull @NotNull StringBuilder sb)
sb - StringBuilder to which the comment will be appended.void clear()
clear in interface WireCommondefault boolean hasMore()
NOTE: This method only works inside a document. Call it just before a document and it won't know not to read the read in case there is padding.
default boolean isNotEmptyAfterPadding()
NOTE: This method only works inside a document. Call it just before a document and it won't know not to read the read in case there is padding.
default boolean isEmpty()
@NotNull default @NotNull WireIn readAlignTo(int alignment)
alignment - The byte boundary to which the read position should align.default boolean readDocument(@Nullable
@Nullable ReadMarshallable metaDataConsumer,
@Nullable
@Nullable ReadMarshallable dataConsumer)
throws net.openhft.chronicle.core.io.InvalidMarshallableException
metaDataConsumer - Consumer that processes the metadata section of the document.dataConsumer - Consumer that processes the main data section of the document.net.openhft.chronicle.core.io.InvalidMarshallableException - if there's an error during marshalling.default boolean readDocument(long position,
@Nullable
@Nullable ReadMarshallable metaDataConsumer,
@Nullable
@Nullable ReadMarshallable dataConsumer)
throws net.openhft.chronicle.core.io.InvalidMarshallableException
position - The position from which to start reading the document.metaDataConsumer - Consumer that processes the metadata section of the document.dataConsumer - Consumer that processes the main data section of the document.net.openhft.chronicle.core.io.InvalidMarshallableException - if there's an error during marshalling.default void rawReadData(@NotNull
@NotNull ReadMarshallable marshallable)
throws net.openhft.chronicle.core.io.InvalidMarshallableException
marshallable - Data to be read in its raw form.net.openhft.chronicle.core.io.InvalidMarshallableException - if there's an error during marshalling.@NotNull @NotNull DocumentContext readingDocument()
readDocument(net.openhft.chronicle.wire.ReadMarshallable,
net.openhft.chronicle.wire.ReadMarshallable) but with out the use of a lambda expressionreadingDocument in interface MarshallableInDocumentContext readingDocument(long readLocation)
readLocation - The position from which to start reading the document.void consumePadding()
void commentListener(Consumer<CharSequence> commentListener)
commentListener - The consumer that handles and processes the comments.default boolean readDataHeader()
throws EOFException
EOFException - if the end of wire marker is reached.@NotNull @NotNull WireIn.HeaderType readDataHeader(boolean includeMetaData) throws EOFException
includeMetaData - If true, metadata headers are included in the read attempt.EOFException - if an end-of-file marker is encountered.void readAndSetLength(long position)
position - The position from which to start reading the length.void readFirstHeader(long timeout,
TimeUnit timeUnit)
throws TimeoutException,
StreamCorruptedException
timeout - Maximum time to wait for a header to be available.timeUnit - The unit of time for the timeout.TimeoutException - If no header is read within the given timeout.StreamCorruptedException - If there is an error in reading the header due to stream corruption.void readFirstHeader()
throws StreamCorruptedException
StreamCorruptedException - If there is an error in reading the header due to stream corruption.void readMetaDataHeader()
String readingPeekYaml()
default void startEvent()
default boolean isEndEvent()
default void endEvent()
default boolean hintReadInputOrder()
default boolean hasMetaDataPrefix()
Copyright © 2024. All rights reserved.