T - The type that extends YamlWireOutpublic abstract class YamlWireOut<T extends YamlWireOut<T>> extends AbstractWire
WireIn.HeaderTypeWireOut.EndOfWire| Modifier and Type | Field and Description |
|---|---|
protected StringBuilder |
sb |
static net.openhft.chronicle.bytes.BytesStore<?,?> |
TYPE |
protected net.openhft.chronicle.wire.YamlWireOut.YamlValueOut |
valueOut |
bytes, classLookup, commentListener, DEFAULT_USE_PADDING, parent, use8bitMARSHALLABLE_IN_INTERN_SIZE| Modifier | Constructor and Description |
|---|---|
protected |
YamlWireOut(@NotNull net.openhft.chronicle.bytes.Bytes bytes,
boolean use8bit)
Constructs a new instance of YamlWireOut with specified bytes and 8-bit flag.
|
| Modifier and Type | Method and Description |
|---|---|
protected @NotNull StringBuilder |
acquireStringBuilder()
Acquires and clears the internal StringBuilder
sb for use. |
T |
addPadding(int paddingToAdd)
Adds padding to the wire.
|
boolean |
addTimeStamps()
Checks if timestamps should be added during serialization.
|
T |
addTimeStamps(boolean addTimeStamps)
Configures whether to add timestamps during serialization.
|
void |
append(@NotNull CharSequence cs)
Appends the given CharSequence
cs to the output bytes using either an 8-bit or UTF-8 encoding, depending on use8bit. |
void |
append(@NotNull CharSequence cs,
int offset,
int length)
Appends a subsequence of the given CharSequence
cs to the output bytes using either an 8-bit or UTF-8 encoding. |
protected void |
appendU4(char ch)
Appends a 4-character hexadecimal Unicode representation of the given character
ch to the output bytes. |
@NotNull net.openhft.chronicle.bytes.Bytes<?> |
bytes()
Returns the underlying
Bytes stored by the wire. |
protected @NotNull net.openhft.chronicle.wire.YamlWireOut.YamlValueOut |
createValueOut()
Creates and returns a new instance of
YamlValueOut. |
T |
dropDefault(boolean dropDefault) |
protected void |
escape0(@NotNull CharSequence s,
@NotNull net.openhft.chronicle.wire.Quotes quotes)
Helper method to escape special characters in the given CharSequence
s based on the requirements of the YAML format. |
@NotNull ValueOut |
getValueOut()
Retrieves the interface for defining the output of a value
that will be written to the stream.
|
protected @NotNull net.openhft.chronicle.wire.Quotes |
needsQuotes(@NotNull CharSequence s)
Determines the type of quotes (if any) required for the given CharSequence
s based on the YAML format's escaping requirements. |
boolean |
trimFirstCurly()
Returns a flag indicating if the top-level curly brackets in the serialized YAML should be dropped.
|
T |
trimFirstCurly(boolean trimFirstCurly)
Sets whether the top-level curly brackets in the serialized YAML should be dropped.
|
@NotNull ValueOut |
write()
Writes an empty field marker to the stream.
|
@NotNull ValueOut |
write(@NotNull CharSequence name)
Writes a CharSequence key to the stream.
|
@NotNull ValueOut |
write(@NotNull WireKey key)
Writes a WireKey to the stream.
|
T |
writeComment(@NotNull 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 |
writeObject(Object o)
Writes the representation of the object
o to the output. |
void |
writeStartEvent()
Start an event object, mostly for internal use.
|
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, waitnewYamlWireOnHeapconsumePadding, copyTo, endEvent, getValueIn, hasMetaDataPrefix, hasMore, hintReadInputOrder, isEmpty, isEndEvent, isNotEmptyAfterPadding, rawReadData, read, read, read, read, readAlignTo, readAllAsMap, readComment, readDataHeader, readDocument, readDocument, readEvent, readEventName, readingDocument, readingDocument, readingPeekYaml, startEventmethodReader, methodReaderBuilder, readBytes, readBytes, readDocument, readMap, readText, readTextacquireWritingDocument, padToCacheAlign, writeAlignTo, writeAllAsMap, writeDocument, writeEventId, writeEventId, writeEventName, writeEventName, writeNotCompleteDocument, writingDocument, writingDocument, writingIsCompleteisBinary, newBooleanReference, newIntArrayReference, newIntReference, newLongArrayReference, newLongReference, newTwoLongReference, reset, useSelfDescribingMessagebuilder, methodWriter, methodWriterBuilder, methodWriterBuilder, recordHistory, writeBytes, writeDocument, writeDocument, writeMap, writeMessage, writeMessage, writeTextrollbackIfNotCompletepublic static final net.openhft.chronicle.bytes.BytesStore<?,?> TYPE
protected final net.openhft.chronicle.wire.YamlWireOut.YamlValueOut valueOut
protected final StringBuilder sb
protected YamlWireOut(@NotNull
@NotNull net.openhft.chronicle.bytes.Bytes bytes,
boolean use8bit)
bytes - The bytes buffer for the wire format.use8bit - Boolean flag indicating whether to use 8-bit values.public boolean addTimeStamps()
public T addTimeStamps(boolean addTimeStamps)
addTimeStamps - Boolean indicating whether to add timestamps.@NotNull protected @NotNull net.openhft.chronicle.wire.YamlWireOut.YamlValueOut createValueOut()
YamlValueOut.@NotNull protected @NotNull StringBuilder acquireStringBuilder()
sb for use.
The method ensures the StringBuilder's count is reset to 0 before returning.@NotNull public @NotNull net.openhft.chronicle.bytes.Bytes<?> bytes()
WireCommonBytes stored by the wire.bytes in interface WireCommonbytes in class AbstractWireBytes stored by the wire@NotNull public @NotNull ValueOut write()
WireOut@NotNull public @NotNull ValueOut write(@NotNull @NotNull WireKey key)
WireOutkey - The WireKey to write to the stream.@NotNull public @NotNull ValueOut write(@NotNull @NotNull CharSequence name)
WireOutname - The CharSequence key to write to the stream.public ValueOut writeEvent(Class<?> expectedType, Object eventKey) throws net.openhft.chronicle.core.io.InvalidMarshallableException
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 T dropDefault(boolean dropDefault)
@NotNull public @NotNull ValueOut getValueOut()
WireOut@NotNull public T writeComment(@NotNull @NotNull CharSequence s)
WireOuts - The comment to be written to the stream.@NotNull public T addPadding(int paddingToAdd)
WireOutpaddingToAdd - The amount of padding to add.protected void escape0(@NotNull
@NotNull CharSequence s,
@NotNull
@NotNull net.openhft.chronicle.wire.Quotes quotes)
s based on the requirements of the YAML format.
The method handles the specific escaping requirements for various control and special characters.s - The CharSequence to be escaped.quotes - The type of quotes used to determine how certain characters are escaped.protected void appendU4(char ch)
ch to the output bytes.
This is used for character escaping.ch - The character to be converted to hexadecimal Unicode representation.@NotNull
protected @NotNull net.openhft.chronicle.wire.Quotes needsQuotes(@NotNull
@NotNull CharSequence s)
s based on the YAML format's escaping requirements.
This method decides between using no quotes, single quotes, or double quotes.s - The CharSequence to be analyzed.public void append(@NotNull
@NotNull CharSequence cs)
cs to the output bytes using either an 8-bit or UTF-8 encoding, depending on use8bit.cs - CharSequence to be appended.public void append(@NotNull
@NotNull CharSequence cs,
int offset,
int length)
cs to the output bytes using either an 8-bit or UTF-8 encoding.cs - CharSequence from which a subsequence will be appended.offset - Starting index of the subsequence.length - Length of the subsequence.public void writeObject(Object o) throws net.openhft.chronicle.core.io.InvalidMarshallableException
o to the output. Differentiates the serialization logic based on the type of the object.o - The object to be serialized.net.openhft.chronicle.core.io.InvalidMarshallableException - if an error occurs during serialization.public void writeStartEvent()
WireOutpublic void writeEndEvent()
public boolean trimFirstCurly()
true if the top-level curly brackets should be dropped; false otherwise.public T trimFirstCurly(boolean trimFirstCurly)
trimFirstCurly - true to drop the top-level curly brackets; false to include them.YamlWireOut (fluent API style).Copyright © 2024. All rights reserved.