@FunctionalInterface public interface MarshallableIn
Note: This interface assumes that you are familiar with the concept of marshallable objects, which are objects that can be marshalled (converted to byte streams) and unmarshalled (converted back to objects).
| Modifier and Type | Field and Description |
|---|---|
static int |
MARSHALLABLE_IN_INTERN_SIZE |
| Modifier and Type | Method and Description |
|---|---|
default @NotNull net.openhft.chronicle.bytes.MethodReader |
methodReader(Object... objects)
Constructs a
MethodReader that can interpret and invoke methods based on the messages
present in this reader. |
default @NotNull VanillaMethodReaderBuilder |
methodReaderBuilder()
Provides a builder instance that can be used to construct and configure a
MethodReader
suitable for this reader's content. |
default boolean |
readBytes(@NotNull net.openhft.chronicle.bytes.Bytes<?> using)
Reads bytes from the source into the provided
Bytes object. |
default boolean |
readBytes(@NotNull net.openhft.chronicle.bytes.ReadBytesMarshallable reader)
Reads bytes using the provided
ReadBytesMarshallable instance. |
default boolean |
readDocument(@NotNull ReadMarshallable reader)
Reads a document using the provided
ReadMarshallable instance. |
@NotNull DocumentContext |
readingDocument()
Provides a
DocumentContext that can be used to read data from a source. |
default <K,V> @Nullable Map<K,V> |
readMap()
Retrieves the next available message and interprets it as a
Map with key-value pairs. |
default @Nullable String |
readText()
Retrieves the next available message as a
String from the underlying source. |
default boolean |
readText(@NotNull StringBuilder sb)
Reads the next available message and populates the provided
StringBuilder with
its contents. |
@NotNull @NotNull DocumentContext readingDocument()
DocumentContext that can be used to read data from a source. The specific
source and the means of reading are determined by the concrete implementation.DocumentContext appropriate for reading from the underlying source.default boolean readDocument(@NotNull
@NotNull ReadMarshallable reader)
throws net.openhft.chronicle.core.io.InvalidMarshallableException
ReadMarshallable instance. This method
simplifies the reading operation by handling the lifecycle of the DocumentContext.reader - The mechanism to use for reading the document.true if the reading operation was successful, otherwise false.net.openhft.chronicle.core.io.InvalidMarshallableExceptiondefault boolean readBytes(@NotNull
@NotNull net.openhft.chronicle.bytes.ReadBytesMarshallable reader)
throws net.openhft.chronicle.core.io.InvalidMarshallableException
ReadBytesMarshallable instance. This method handles
the extraction of bytes from the source and offers them to the reader for processing.reader - The mechanism to use for reading the bytes.true if the reading operation was successful, otherwise false.net.openhft.chronicle.core.io.InvalidMarshallableExceptiondefault boolean readBytes(@NotNull
@NotNull net.openhft.chronicle.bytes.Bytes<?> using)
throws net.openhft.chronicle.core.io.InvalidMarshallableException
Bytes object. This method allows for
direct population of a Bytes instance without additional translation or processing.using - The Bytes object to populate with read data.true if the reading operation was successful, otherwise false.net.openhft.chronicle.core.io.InvalidMarshallableException@Nullable default @Nullable String readText() throws net.openhft.chronicle.core.io.InvalidMarshallableException
String from the underlying source. This
method aims to simplify string-based message reading and provides the capability to
handle large messages efficiently using string interning.String if available, otherwise null.net.openhft.chronicle.core.io.InvalidMarshallableExceptiondefault boolean readText(@NotNull
@NotNull StringBuilder sb)
throws net.openhft.chronicle.core.io.InvalidMarshallableException
StringBuilder with
its contents. This method offers flexibility for clients that wish to control the
string allocation and reuse the same StringBuilder for multiple reads.sb - The StringBuilder instance to populate with the message content.true if a message was read and the StringBuilder was populated,
otherwise false.net.openhft.chronicle.core.io.InvalidMarshallableException@Nullable default <K,V> @Nullable Map<K,V> readMap() throws net.openhft.chronicle.core.io.InvalidMarshallableException
Map with key-value pairs.
The method is designed to be generic, allowing clients to specify the expected key and value types
at the call site. If no message is available or the content does not represent a map, appropriate
fallbacks like null or an empty map are returned.K - The expected type of the keys in the map.V - The expected type of the values in the map.Map constructed from the message, null if no message is available, or
an empty map if the content does not represent a map.net.openhft.chronicle.core.io.InvalidMarshallableException@NotNull default @NotNull net.openhft.chronicle.bytes.MethodReader methodReader(Object... objects)
MethodReader that can interpret and invoke methods based on the messages
present in this reader. The constructed reader will interpret each message as a method call and
will use the provided objects to invoke the corresponding methods.objects - Objects that implement the methods serialized to the file. These objects will be
used as the targets for method invocation based on the interpreted messages.MethodReader set up to read and interpret method calls from this reader's messages.@NotNull default @NotNull VanillaMethodReaderBuilder methodReaderBuilder()
MethodReader
suitable for this reader's content. The builder offers flexibility in configuring the
MethodReader to suit specific requirements.VanillaMethodReaderBuilder for creating and customizing a MethodReader.Copyright © 2024. All rights reserved.