public class YamlWire extends YamlWireOut<YamlWire>
WireIn.HeaderTypeWireOut.EndOfWiresb, TYPE, valueOutbytes, classLookup, commentListener, DEFAULT_USE_PADDING, parent, use8bitMARSHALLABLE_IN_INTERN_SIZE| Constructor and Description |
|---|
YamlWire(@NotNull net.openhft.chronicle.bytes.Bytes<?> bytes)
Constructor that initializes the YamlWire with provided bytes.
|
YamlWire(@NotNull net.openhft.chronicle.bytes.Bytes<?> bytes,
boolean use8bit)
Constructor that initializes the YamlWire with provided bytes and a flag indicating the use of 8-bit.
|
| Modifier and Type | Method and Description |
|---|---|
DocumentContext |
acquireWritingDocument(boolean metaData)
Obtains a
DocumentContext for writing. |
static String |
asText(@NotNull Wire wire)
Converts the content of a given
Wire object into its string representation. |
void |
clear()
Clears the WireIn, effectively resetting its state.
|
protected void |
consumeDocumentStart()
Consumes and skips the start of a YAML document, e.g., '---'.
|
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.
|
protected @NotNull net.openhft.chronicle.wire.YamlWire.TextValueIn |
createValueIn()
Creates a new instance of
TextValueIn. |
String |
dumpContext()
Produces a dump of the current parsing context.
|
void |
endEvent()
Marks the end of an event or method flow.
|
static @NotNull YamlWire |
from(@NotNull String text)
Utility method to create a new YamlWire instance from a given text string.
|
static @NotNull YamlWire |
fromFile(String name)
Utility method to create a new YamlWire instance by reading bytes from a specified file.
|
@NotNull ValueIn |
getValueIn()
Obtains the value associated with a field or event for more advanced use cases.
|
boolean |
hasMetaDataPrefix()
Checks if the current position in the stream has a metadata prefix.
|
boolean |
hintReadInputOrder()
Provides a hint about the order in which the input should be read.
|
protected void |
initReadContext()
Initializes the reading context.
|
boolean |
isBinary()
Determine whether direct access to the underlying byte() makes sense or should it be treated as text
|
boolean |
isEndEvent()
Checks if the current position in the stream represents the end of an event or method flow.
|
boolean |
isNotEmptyAfterPadding()
This consumes any padding before checking if readRemaining() > 0
|
@NotNull VanillaMethodReaderBuilder |
methodReaderBuilder()
Provides a builder instance that can be used to construct and configure a
MethodReader
suitable for this reader's content. |
<T> T |
methodWriter(@NotNull Class<T> tClass,
Class<?>... additional)
Creates a proxy of the specified interfaces, where each method call on the proxy is written for replay.
|
<T> @NotNull net.openhft.chronicle.bytes.MethodWriterBuilder<T> |
methodWriterBuilder(@NotNull Class<T> tClass)
Returns a
MethodWriterBuilder that can be used to create a proxy for an interface. |
@NotNull net.openhft.chronicle.core.values.BooleanValue |
newBooleanReference()
Creates and returns a new
BooleanValue. |
@NotNull net.openhft.chronicle.core.values.IntArrayValues |
newIntArrayReference()
Creates and returns a new
IntArrayValues. |
@NotNull net.openhft.chronicle.core.values.IntValue |
newIntReference()
Creates and returns a new
IntValue. |
@NotNull net.openhft.chronicle.core.values.LongArrayValues |
newLongArrayReference()
Creates and returns a new
LongArrayValues. |
@NotNull net.openhft.chronicle.core.values.LongValue |
newLongReference()
Creates and returns a new
LongValue. |
@NotNull ValueIn |
read()
Reads the next field if present, or returns an empty string if not present.
|
@NotNull ValueIn |
read(String keyName)
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.
|
@NotNull Wire |
readComment(@NotNull StringBuilder s)
Reads a comment from the Wire data and appends it to the provided StringBuilder.
|
boolean |
readDocument(long position,
@Nullable ReadMarshallable metaDataConsumer,
@Nullable ReadMarshallable dataConsumer)
Reads a document from a specific position, consuming both its metadata and data sections.
|
boolean |
readDocument(@Nullable ReadMarshallable metaDataConsumer,
@Nullable ReadMarshallable dataConsumer)
Reads a document, consuming both its metadata and data sections.
|
<K> K |
readEvent(@NotNull Class<K> expectedClass)
Reads a field which may contain an object of any specified type.
|
long |
readEventNumber()
Reads the next event number.
|
protected @NotNull StringBuilder |
readField(@NotNull StringBuilder sb)
Reads a field from the current YamlToken and appends its content to the provided StringBuilder.
|
@NotNull DocumentContext |
readingDocument()
Provides a
DocumentContext that can be used to read data from a source. |
@NotNull DocumentContext |
readingDocument(long readLocation)
Provides a context for reading a document starting at a specific position.
|
@NotNull String |
readingPeekYaml()
Peeks at the content in the current WireIn instance and returns it as a YAML string.
|
void |
reset()
Resets the state of the YamlWire instance, clearing all buffers and contexts.
|
void |
rollbackIfNotComplete()
Rolls back the current operation if it is not complete.
|
void |
startEvent()
Marks the start of an event or method flow.
|
String |
toString()
Converts the current YamlWire instance into a string representation.
|
@NotNull YamlWire |
useBinaryDocuments()
Configures the YamlWire to use binary format for document reading and writing.
|
boolean |
useSelfDescribingMessage(@NotNull net.openhft.chronicle.bytes.CommonMarshallable object)
Should this wire write the object as a Marshallable or BytesMarshallable
|
@NotNull YamlWire |
useTextDocuments()
Configures the YamlWire to use text format for document reading and writing.
|
@NotNull DocumentContext |
writingDocument(boolean metaData)
Initiates a new
DocumentContext for writing, with an option to include
metadata. |
boolean |
writingIsComplete()
Checks if the current writing operation is complete.
|
acquireStringBuilder, addPadding, addTimeStamps, addTimeStamps, append, append, appendU4, bytes, createValueOut, dropDefault, escape0, getValueOut, needsQuotes, trimFirstCurly, trimFirstCurly, write, write, write, writeComment, writeEndEvent, writeEvent, writeObject, writeStartEventbytesComment, classLookup, classLookup, commentListener, endOfWire, enterHeader, forceNotInsideHeader, headerNumber, headerNumber, headNumberCheck, isInsideHeader, notCompleteIsNotPresent, notCompleteIsNotPresent, objectInput, objectOutput, parent, parent, pauser, pauser, readAndSetLength, readDataHeader, readFirstHeader, readFirstHeader, readMetaDataHeader, updateFirstHeader, updateFirstHeader, updateHeader, usePadding, usePadding, writeEndOfWire, writeFirstHeaderclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitnewYamlWireOnHeaphasMore, isEmpty, rawReadData, readAlignTo, readAllAsMap, readDataHeader, readEventNamemethodReader, readBytes, readBytes, readDocument, readMap, readText, readTextpadToCacheAlign, writeAlignTo, writeAllAsMap, writeDocument, writeEventId, writeEventId, writeEventName, writeEventName, writeNotCompleteDocument, writingDocumentnewTwoLongReferencebuilder, methodWriterBuilder, recordHistory, writeBytes, writeDocument, writeDocument, writeMap, writeMessage, writeMessage, writeTextpublic YamlWire(@NotNull
@NotNull net.openhft.chronicle.bytes.Bytes<?> bytes,
boolean use8bit)
bytes - Bytes from which YamlWire is initializeduse8bit - A boolean flag to indicate the use of 8-bitpublic YamlWire(@NotNull
@NotNull net.openhft.chronicle.bytes.Bytes<?> bytes)
bytes - Bytes from which YamlWire is initialized@NotNull public static @NotNull YamlWire fromFile(String name) throws IOException
name - Name of the file from which bytes are readIOException - If there's an error in reading the file@NotNull public static @NotNull YamlWire from(@NotNull @NotNull String text)
text - String from which the YamlWire instance is initializedpublic static String asText(@NotNull @NotNull Wire wire) throws net.openhft.chronicle.core.io.InvalidMarshallableException
Wire object into its string representation.wire - The Wire object whose content needs to be converted to string.net.openhft.chronicle.core.io.InvalidMarshallableException - If the given wire's content cannot be marshalled.public boolean isBinary()
WireCommonpublic boolean hintReadInputOrder()
WireIn@NotNull
public <T> T methodWriter(@NotNull
@NotNull Class<T> tClass,
Class<?>... additional)
MarshallableOuttClass - primary interfaceadditional - any additional interfaces@NotNull
public <T> @NotNull net.openhft.chronicle.bytes.MethodWriterBuilder<T> methodWriterBuilder(@NotNull
@NotNull Class<T> tClass)
MarshallableOutMethodWriterBuilder that can be used to create a proxy for an interface.
Each message called on the proxy will be written for replay. This is a convenience method
that assumes metadata is not required.tClass - The primary interface that the builder will cater to.MethodWriterBuilder tailored for the given interface class.@NotNull public @NotNull VanillaMethodReaderBuilder methodReaderBuilder()
MarshallableInMethodReader
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.@NotNull public @NotNull DocumentContext writingDocument(boolean metaData)
DocumentWrittenDocumentContext for writing, with an option to include
metadata. It is imperative to always invoke the close() method on the context
after completing the write operation.metaData - A boolean indicating if metadata should be included during writing.DocumentContext tailored to the metadata preference.public DocumentContext acquireWritingDocument(boolean metaData)
DocumentWrittenDocumentContext for writing. This method either initiates a new context
or reuses an existing one. Depending on the use case, calling the close() method
on the context might be optional.metaData - A boolean indicating if metadata should be included during writing.DocumentContext tailored to the metadata preference.@NotNull public @NotNull DocumentContext readingDocument()
MarshallableInDocumentContext 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.protected void initReadContext()
@NotNull public @NotNull YamlWire useBinaryDocuments()
@NotNull public @NotNull YamlWire useTextDocuments()
@NotNull public @NotNull DocumentContext readingDocument(long readLocation)
WireInreadLocation - The position from which to start reading the document.@NotNull protected @NotNull net.openhft.chronicle.wire.YamlWire.TextValueIn createValueIn()
TextValueIn. This method can be overridden
by subclasses to provide a custom implementation of TextValueIn.public String toString()
public void copyTo(@NotNull
@NotNull WireOut wire)
throws net.openhft.chronicle.core.io.InvalidMarshallableException
WireInwire - 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.public long readEventNumber()
WireInreadEventNumber in interface WireInreadEventNumber in class AbstractWire@NotNull public @NotNull ValueIn read()
WireInValueIn instance.@NotNull protected @NotNull StringBuilder readField(@NotNull @NotNull StringBuilder sb)
sb - StringBuilder instance to which the field content will be appended.@Nullable
public <K> K readEvent(@NotNull
@NotNull Class<K> expectedClass)
throws net.openhft.chronicle.core.io.InvalidMarshallableException
WireInK - 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.public boolean isNotEmptyAfterPadding()
WireInNOTE: 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.
public void consumePadding()
WireIn@NotNull public @NotNull String readingPeekYaml()
WireIn@NotNull public @NotNull ValueIn read(@NotNull @NotNull WireKey key)
WireInWireKey.key - The WireKey that should match the next field.ValueIn instance.@NotNull public @NotNull ValueIn read(String keyName)
WireInkeyName - The name of the field to read.ValueIn instance.public String dumpContext()
@NotNull public @NotNull ValueIn read(@NotNull @NotNull StringBuilder name)
WireInname - The name of the field to read.ValueIn instance.@NotNull public @NotNull ValueIn getValueIn()
WireInWireIn.readEvent(Class).ValueIn instance.@NotNull public @NotNull Wire readComment(@NotNull @NotNull StringBuilder s)
WireIns - StringBuilder to which the comment will be appended.public void clear()
WireInclear in interface WireCommonclear in interface WireInclear in interface WireOutclear in class AbstractWireprotected void consumeDocumentStart()
@NotNull public @NotNull net.openhft.chronicle.core.values.LongValue newLongReference()
WireCommonLongValue. The LongValue implementation that is
returned depends on the wire implementation.LongValue@NotNull public @NotNull net.openhft.chronicle.core.values.BooleanValue newBooleanReference()
WireCommonBooleanValue. The BooleanValue implementation that is
returned depends on the wire implementation.BooleanValue.public boolean useSelfDescribingMessage(@NotNull
@NotNull net.openhft.chronicle.bytes.CommonMarshallable object)
WireCommon@NotNull public @NotNull net.openhft.chronicle.core.values.IntValue newIntReference()
WireCommonIntValue. The IntValue implementation that is
returned depends on the wire implementation.IntValue.@NotNull public @NotNull net.openhft.chronicle.core.values.LongArrayValues newLongArrayReference()
WireCommonLongArrayValues. The LongArrayValues implementation that
is returned depends on the wire implementation.LongArrayValues@NotNull public @NotNull net.openhft.chronicle.core.values.IntArrayValues newIntArrayReference()
WireCommonIntArrayValues. The IntArrayValues implementation that
is returned depends on the wire implementation.IntArrayValuespublic void startEvent()
WireInpublic boolean isEndEvent()
WireInpublic void endEvent()
WireInpublic void reset()
public boolean hasMetaDataPrefix()
WireInpublic boolean readDocument(@Nullable
@Nullable ReadMarshallable metaDataConsumer,
@Nullable
@Nullable ReadMarshallable dataConsumer)
throws net.openhft.chronicle.core.io.InvalidMarshallableException
WireInmetaDataConsumer - 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.public boolean readDocument(long position,
@Nullable
@Nullable ReadMarshallable metaDataConsumer,
@Nullable
@Nullable ReadMarshallable dataConsumer)
throws net.openhft.chronicle.core.io.InvalidMarshallableException
WireInposition - 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.public boolean writingIsComplete()
RollbackIfNotCompleteNotifierpublic void rollbackIfNotComplete()
RollbackIfNotCompleteNotifierCopyright © 2024. All rights reserved.