public interface WireOut extends WireCommon, MarshallableOut
| Modifier and Type | Interface and Description |
|---|---|
static class |
WireOut.EndOfWire |
| 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 |
clear()
Resets both the positions in the wire and the header number.
|
default @NotNull WireOut |
dropDefault(boolean dropDefault) |
default WireOut.EndOfWire |
endOfWire(boolean writeEOF,
long timeout,
TimeUnit timeUnit,
long lastPosition)
Check if end of wire marker is present, optionally writing it unless one is already written.
|
long |
enterHeader(long safeLength)
INTERNAL METHOD, call writingDocument instead
|
@NotNull ValueOut |
getValueOut()
Retrieves the interface for defining the output of a value
that will be written to the stream.
|
ObjectOutput |
objectOutput()
Get the ObjectOutput associated with this WireOut.
|
default @NotNull WireOut |
padToCacheAlign()
Ensures that the wire's output aligns with cache boundaries.
|
void |
updateFirstHeader()
INTERNAL METHOD, call writingDocument instead
|
void |
updateFirstHeader(long headerLen)
INTERNAL METHOD, call writingDocument instead
|
void |
updateHeader(long position,
boolean metaData,
int expectedHeader)
INTERNAL METHOD, call writingDocument instead
|
@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.
|
default @NotNull WireOut |
writeAlignTo(int alignment,
int plus)
Aligns the write position to the provided alignment boundary, taking into account
the specified offset (plus).
|
default <K,V> void |
writeAllAsMap(Class<K> kClass,
Class<V> vClass,
@NotNull Map<K,V> map) |
@NotNull WireOut |
writeComment(CharSequence s)
Writes a comment to the wire.
|
default void |
writeDocument(boolean metaData,
@NotNull WriteMarshallable writer)
Writes a document to the wire.
|
void |
writeEndEvent() |
boolean |
writeEndOfWire(long timeout,
TimeUnit timeUnit,
long lastPosition)
Write the end of wire marker, unless one is already written.
|
default ValueOut |
writeEvent(Class<?> expectedType,
Object eventKey)
Writes an event to the stream based on the type and event key.
|
default ValueOut |
writeEventId(int methodId)
Writes an event identifier to the stream.
|
default ValueOut |
writeEventId(String name,
int methodId)
Writes an event identifier with a name to the stream.
|
default ValueOut |
writeEventName(CharSequence key)
Writes a CharSequence key to the stream.
|
default @NotNull ValueOut |
writeEventName(WireKey key)
Writes a key to the stream.
|
boolean |
writeFirstHeader()
INTERNAL METHOD, call writingDocument instead
|
default void |
writeNotCompleteDocument(boolean metaData,
@NotNull WriteMarshallable writer)
Writes a document to the wire without marking its completion.
|
void |
writeStartEvent()
Start an event object, mostly for internal use.
|
default @NotNull DocumentContext |
writingDocument()
Starts the process of writing a data document (not metadata) to the wire.
|
DocumentContext |
writingDocument(boolean metaData)
Starts the process of writing a document to the wire with an option for metadata.
|
default boolean |
writingIsComplete()
Checks if the current writing operation is complete.
|
bytes, bytesComment, classLookup, classLookup, headerNumber, headerNumber, isBinary, newBooleanReference, newIntArrayReference, newIntReference, newLongArrayReference, newLongReference, newTwoLongReference, notCompleteIsNotPresent, notCompleteIsNotPresent, parent, parent, pauser, pauser, reset, usePadding, usePadding, useSelfDescribingMessagebuilder, methodWriter, methodWriterBuilder, methodWriterBuilder, recordHistory, writeBytes, writeDocument, writeDocument, writeMap, writeMessage, writeMessage, writeTextrollbackIfNotComplete@NotNull @NotNull ValueOut write()
@NotNull default @NotNull ValueOut writeEventName(WireKey key)
key - The key to write to the stream.default ValueOut writeEventName(CharSequence key)
key - The CharSequence key to write to the stream.default ValueOut writeEvent(Class<?> expectedType, Object eventKey) throws net.openhft.chronicle.core.io.InvalidMarshallableException
expectedType - 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.default ValueOut writeEventId(int methodId)
methodId - The ID of the method representing the event.default ValueOut writeEventId(String name, int methodId)
name - The name of the event.methodId - The ID of the method representing the event.@NotNull @NotNull ValueOut write(WireKey key)
key - The WireKey to write to the stream.ValueOut write(CharSequence key)
key - The CharSequence key to write to the stream.@NotNull @NotNull ValueOut getValueOut()
ObjectOutput objectOutput()
@NotNull @NotNull WireOut writeComment(CharSequence s)
s - The comment to be written to the stream.@NotNull @NotNull WireOut addPadding(int paddingToAdd)
paddingToAdd - The amount of padding to add.@NotNull default @NotNull WireOut padToCacheAlign()
@NotNull default @NotNull WireOut writeAlignTo(int alignment, int plus)
alignment - The alignment boundary.plus - Additional offset to the write position.void clear()
clear in interface WireCommondefault void writeDocument(boolean metaData,
@NotNull
@NotNull WriteMarshallable writer)
throws net.openhft.chronicle.core.io.InvalidMarshallableException
metaData - Indicates if metadata should be written.writer - The logic for writing the content of the document.net.openhft.chronicle.core.io.InvalidMarshallableExceptionDocumentContext writingDocument(boolean metaData)
writingDocument in interface DocumentWrittenwritingDocument in interface MarshallableOutmetaData - If true, the returned document context will be used for writing metadata.@NotNull default @NotNull DocumentContext writingDocument()
writingDocument in interface DocumentWrittenwritingDocument in interface MarshallableOutDocumentContext acquireWritingDocument(boolean metaData)
acquireWritingDocument in interface DocumentWrittenacquireWritingDocument in interface MarshallableOutmetaData - If true, the returned context will be used for writing metadata.default void writeNotCompleteDocument(boolean metaData,
@NotNull
@NotNull WriteMarshallable writer)
throws net.openhft.chronicle.core.io.InvalidMarshallableException
metaData - If true, metadata will be written instead of regular data.writer - Logic for writing the content of the document.net.openhft.chronicle.core.io.InvalidMarshallableExceptionvoid updateHeader(long position,
boolean metaData,
int expectedHeader)
throws StreamCorruptedException
Update/end a header for a document
StreamCorruptedExceptionlong enterHeader(long safeLength)
Start a header for a document
safeLength - ensure there is at least this much spaceWriteAfterEOFException - if you attempt to append an excerpt after an EOF has been writtenboolean writeFirstHeader()
Start the first header, if there is none This will increment the headerNumber as appropriate if successful
Note: the file might contain other data and the caller has to check this.
void updateFirstHeader()
update the first header after writing.
void updateFirstHeader(long headerLen)
update the first header after writing headerEndPos bytes.
boolean writeEndOfWire(long timeout,
TimeUnit timeUnit,
long lastPosition)
timeout - throw TimeoutException if it could not write the marker in time.timeUnit - of the timeoutlastPosition - the end of the wirefalse if it was already there.default WireOut.EndOfWire endOfWire(boolean writeEOF, long timeout, TimeUnit timeUnit, long lastPosition)
writeEOF - if true, write end of wire marker unless already existstimeout - throw TimeoutException if it could not write the marker in time.timeUnit - of the timeoutlastPosition - the end of the wireWireOut.EndOfWire enum corresponding to EOF presencevoid writeStartEvent()
void writeEndEvent()
default <K,V> void writeAllAsMap(Class<K> kClass, Class<V> vClass, @NotNull @NotNull Map<K,V> map)
@NotNull default @NotNull WireOut dropDefault(boolean dropDefault)
default boolean writingIsComplete()
RollbackIfNotCompleteNotifierwritingIsComplete in interface RollbackIfNotCompleteNotifierCopyright © 2024. All rights reserved.