public abstract class AbstractAnyWire extends AbstractWire implements Wire
TextWire or BinaryWire.
This class provides a generic foundation for wire types that could shift between the two mentioned types
based on the underlying acquisition logic.WireIn.HeaderTypeWireOut.EndOfWire| Modifier and Type | Field and Description |
|---|---|
protected @NotNull net.openhft.chronicle.wire.AbstractAnyWire.WireAcquisition |
wireAcquisition |
bytes, classLookup, commentListener, DEFAULT_USE_PADDING, parent, use8bitMARSHALLABLE_IN_INTERN_SIZE| Modifier | Constructor and Description |
|---|---|
protected |
AbstractAnyWire(@NotNull net.openhft.chronicle.bytes.Bytes<?> bytes,
@NotNull net.openhft.chronicle.wire.AbstractAnyWire.WireAcquisition wa)
Constructs a new instance of
AbstractAnyWire using the specified bytes and wire acquisition strategy. |
| Modifier and Type | Method and Description |
|---|---|
DocumentContext |
acquireWritingDocument(boolean metaData)
Retrieves a context for writing either data or metadata, reusing an existing context if available.
|
@NotNull WireOut |
addPadding(int paddingToAdd)
Adds padding to the wire.
|
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.
|
@NotNull ValueIn |
getValueIn()
Obtains the value associated with a field or event for more advanced use cases.
|
@NotNull ValueOut |
getValueOut()
Retrieves the interface for defining the output of a value
that will be written to the stream.
|
@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(@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 WireIn |
readComment(@NotNull StringBuilder sb)
Reads a comment from the Wire data and appends it to the provided StringBuilder.
|
<K> K |
readEvent(Class<K> expectedClass)
Reads a field which may contain an object of any specified type.
|
@NotNull DocumentContext |
readingDocument()
equivalent to
WireIn.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.
|
@NotNull Supplier<WireType> |
underlyingType()
Provides a supplier that indicates the type of the underlying wire.
|
@Nullable Wire |
underlyingWire()
Retrieves the underlying wire, which could be either
TextWire or BinaryWire,
based on the acquisition strategy. |
@NotNull ValueOut |
write()
Writes an empty field marker to the stream.
|
ValueOut |
write(CharSequence key)
Writes a CharSequence key to the stream.
|
@NotNull ValueOut |
write(WireKey key)
Writes a WireKey to the stream.
|
@NotNull WireOut |
writeComment(CharSequence s)
Writes a comment to the wire.
|
void |
writeEndEvent() |
ValueOut |
writeEvent(Class<?> expectedType,
Object eventKey)
Writes an event to the stream based on the type and event key.
|
void |
writeStartEvent()
Start an event object, mostly for internal use.
|
DocumentContext |
writingDocument(boolean metaData)
Starts the process of writing a document to the wire with an option for metadata.
|
bytes, bytesComment, classLookup, classLookup, clear, commentListener, endOfWire, enterHeader, forceNotInsideHeader, headerNumber, headerNumber, headNumberCheck, isInsideHeader, notCompleteIsNotPresent, notCompleteIsNotPresent, objectInput, objectOutput, parent, parent, pauser, pauser, readAndSetLength, readDataHeader, readEventNumber, readFirstHeader, readFirstHeader, readMetaDataHeader, updateFirstHeader, updateFirstHeader, updateHeader, usePadding, usePadding, writeEndOfWire, writeFirstHeaderclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitheaderNumber, newYamlWireOnHeapclear, commentListener, endEvent, hasMetaDataPrefix, hasMore, hintReadInputOrder, isEmpty, isEndEvent, isNotEmptyAfterPadding, objectInput, rawReadData, read, readAlignTo, readAllAsMap, readAndSetLength, readDataHeader, readDataHeader, readDocument, readDocument, readEventName, readEventNumber, readFirstHeader, readFirstHeader, readMetaDataHeader, startEventmethodReader, methodReaderBuilder, readBytes, readBytes, readDocument, readMap, readText, readTextclear, dropDefault, endOfWire, enterHeader, objectOutput, padToCacheAlign, updateFirstHeader, updateFirstHeader, updateHeader, writeAlignTo, writeAllAsMap, writeDocument, writeEndOfWire, writeEventId, writeEventId, writeEventName, writeEventName, writeFirstHeader, writeNotCompleteDocument, writingDocument, writingIsCompletebytes, bytesComment, classLookup, classLookup, headerNumber, isBinary, newBooleanReference, newTwoLongReference, notCompleteIsNotPresent, notCompleteIsNotPresent, parent, parent, pauser, pauser, reset, usePadding, usePadding, useSelfDescribingMessagebuilder, methodWriter, methodWriterBuilder, methodWriterBuilder, recordHistory, writeBytes, writeDocument, writeDocument, writeMap, writeMessage, writeMessage, writeTextrollbackIfNotComplete@NotNull protected final @NotNull net.openhft.chronicle.wire.AbstractAnyWire.WireAcquisition wireAcquisition
protected AbstractAnyWire(@NotNull
@NotNull net.openhft.chronicle.bytes.Bytes<?> bytes,
@NotNull
@NotNull net.openhft.chronicle.wire.AbstractAnyWire.WireAcquisition wa)
AbstractAnyWire using the specified bytes and wire acquisition strategy.bytes - The byte storage and manipulation object.wa - The strategy to acquire the actual wire type.@Nullable public @Nullable Wire underlyingWire()
TextWire or BinaryWire,
based on the acquisition strategy.@NotNull public @NotNull Supplier<WireType> underlyingType()
WireType.public void copyTo(@NotNull
@NotNull WireOut wire)
throws net.openhft.chronicle.core.io.InvalidMarshallableException
WireIn@NotNull public @NotNull ValueIn read()
WireIn@NotNull public @NotNull ValueIn read(@NotNull @NotNull WireKey key)
WireInWireKey.@NotNull public @NotNull ValueIn read(@NotNull @NotNull StringBuilder name)
WireIn@Nullable public <K> K readEvent(Class<K> expectedClass) throws net.openhft.chronicle.core.io.InvalidMarshallableException
WireInreadEvent in interface 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 void writeStartEvent()
WireOutwriteStartEvent in interface WireOutpublic void writeEndEvent()
writeEndEvent in interface WireOut@NotNull public @NotNull ValueIn getValueIn()
WireInWireIn.readEvent(Class).getValueIn in interface WireInValueIn instance.@NotNull public @NotNull WireIn readComment(@NotNull @NotNull StringBuilder sb)
WireInreadComment in interface WireInsb - StringBuilder to which the comment will be appended.@NotNull public @NotNull net.openhft.chronicle.core.values.IntValue newIntReference()
WireCommonIntValue. The IntValue implementation that is
returned depends on the wire implementation.newIntReference in interface WireCommonIntValue.@NotNull public @NotNull net.openhft.chronicle.core.values.LongValue newLongReference()
WireCommonLongValue. The LongValue implementation that is
returned depends on the wire implementation.newLongReference in interface WireCommonLongValue@NotNull public @NotNull net.openhft.chronicle.core.values.LongArrayValues newLongArrayReference()
WireCommonLongArrayValues. The LongArrayValues implementation that
is returned depends on the wire implementation.newLongArrayReference in interface WireCommonLongArrayValues@NotNull public @NotNull net.openhft.chronicle.core.values.IntArrayValues newIntArrayReference()
WireCommonIntArrayValues. The IntArrayValues implementation that
is returned depends on the wire implementation.newIntArrayReference in interface WireCommonIntArrayValues@NotNull public @NotNull DocumentContext readingDocument()
WireInWireIn.readDocument(net.openhft.chronicle.wire.ReadMarshallable,
net.openhft.chronicle.wire.ReadMarshallable) but with out the use of a lambda expressionreadingDocument in interface MarshallableInreadingDocument in interface WireInpublic DocumentContext readingDocument(long readLocation)
WireInreadingDocument in interface WireInreadLocation - The position from which to start reading the document.public void consumePadding()
WireInconsumePadding in interface WireIn@NotNull public @NotNull ValueOut write()
WireOut@NotNull public @NotNull ValueOut write(WireKey key)
WireOutpublic ValueOut write(CharSequence key)
WireOutpublic ValueOut writeEvent(Class<?> expectedType, Object eventKey) throws net.openhft.chronicle.core.io.InvalidMarshallableException
WireOutwriteEvent in interface WireOutexpectedType - The expected type of the event to write.eventKey - The key of the event.net.openhft.chronicle.core.io.InvalidMarshallableException - if there's an error marshalling the event.@NotNull public @NotNull ValueOut getValueOut()
WireOutgetValueOut in interface WireOut@NotNull public @NotNull WireOut writeComment(CharSequence s)
WireOutwriteComment in interface WireOuts - The comment to be written to the stream.@NotNull public @NotNull WireOut addPadding(int paddingToAdd)
WireOutaddPadding in interface WireOutpaddingToAdd - The amount of padding to add.public DocumentContext writingDocument(boolean metaData)
WireOutwritingDocument in interface DocumentWrittenwritingDocument in interface MarshallableOutwritingDocument in interface WireOutmetaData - If true, the returned document context will be used for writing metadata.public DocumentContext acquireWritingDocument(boolean metaData)
WireOutacquireWritingDocument in interface DocumentWrittenacquireWritingDocument in interface MarshallableOutacquireWritingDocument in interface WireOutmetaData - If true, the returned context will be used for writing metadata.public String readingPeekYaml()
WireInreadingPeekYaml in interface WireInCopyright © 2024. All rights reserved.