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)
Start or reuse an existing a DocumentContext, optionally call close() when done.
|
@NotNull WireOut |
addPadding(int paddingToAdd) |
void |
clear()
This will reset the positions 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()
Obtain the value out
|
ObjectOutput |
objectOutput() |
default @NotNull WireOut |
padToCacheAlign()
If near the end of a cache line, pad it so a following 4-byte int value will not split a
cache line.
|
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()
Write an empty filed marker
|
ValueOut |
write(CharSequence key) |
@NotNull ValueOut |
write(WireKey key)
Write a key for wires that support fields.
|
default @NotNull WireOut |
writeAlignTo(int alignment,
int plus) |
default <K,V> void |
writeAllAsMap(Class<K> kClass,
Class<V> vClass,
@NotNull Map<K,V> map) |
@NotNull WireOut |
writeComment(CharSequence s) |
default void |
writeDocument(boolean metaData,
@NotNull WriteMarshallable writer)
This will increment the headerNumber as appropriate if successful
|
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) |
default ValueOut |
writeEventId(int methodId) |
default ValueOut |
writeEventId(String name,
int methodId) |
default ValueOut |
writeEventName(CharSequence key) |
default @NotNull ValueOut |
writeEventName(WireKey key)
Always write a key.
|
boolean |
writeFirstHeader()
INTERNAL METHOD, call writingDocument instead
|
default void |
writeNotCompleteDocument(boolean metaData,
@NotNull WriteMarshallable writer)
This will increment the headerNumber as appropriate if successful
|
void |
writeStartEvent()
Start an event object, mostly for internal use.
|
default @NotNull DocumentContext |
writingDocument()
Start a document which is completed when DocumentContext.close() is called.
|
DocumentContext |
writingDocument(boolean metaData)
This will increment the headerNumber as appropriate if successful
|
default boolean |
writingIsComplete() |
bytes, bytesComment, classLookup, classLookup, headerNumber, headerNumber, isBinary, newBooleanReference, newIntArrayReference, newIntReference, newLongArrayReference, newLongReference, newTwoLongReference, notCompleteIsNotPresent, notCompleteIsNotPresent, parent, parent, pauser, pauser, reset, usePadding, usePadding, useSelfDescribingMessagebuilder, methodWriter, methodWriter, methodWriterBuilder, methodWriterBuilder, recordHistory, writeBytes, writeDocument, writeDocument, writeMap, writeMessage, writeMessage, writeText@NotNull @NotNull ValueOut write()
@NotNull default @NotNull ValueOut writeEventName(WireKey key)
default ValueOut writeEventName(CharSequence key)
default ValueOut writeEvent(Class expectedType, Object eventKey) throws net.openhft.chronicle.core.io.InvalidMarshallableException
net.openhft.chronicle.core.io.InvalidMarshallableExceptiondefault ValueOut writeEventId(int methodId)
ValueOut write(CharSequence key)
@NotNull @NotNull ValueOut getValueOut()
ObjectOutput objectOutput()
@NotNull @NotNull WireOut writeComment(CharSequence s)
@NotNull @NotNull WireOut addPadding(int paddingToAdd)
@NotNull default @NotNull WireOut padToCacheAlign()
@NotNull default @NotNull WireOut writeAlignTo(int alignment, int plus)
void clear()
clear in interface WireCommondefault void writeDocument(boolean metaData,
@NotNull
@NotNull WriteMarshallable writer)
throws net.openhft.chronicle.core.io.InvalidMarshallableException
net.openhft.chronicle.core.io.InvalidMarshallableExceptionDocumentContext writingDocument(boolean metaData)
writingDocument in interface DocumentWrittenwritingDocument in interface MarshallableOutmetaData - if true the document context will be used for writing meta data,
otherwise data@NotNull default @NotNull DocumentContext writingDocument()
MarshallableOut
try(DocumentContext dc = appender.writingDocument()) {
dc.wire().write("message").text("Hello World");
}
WARNING : any data written inside the writingDocument(), should be performed as quickly as possible because a write lock is held until the DocumentContext is closed by the try-with-resources, this blocks other appenders and tailers.
try (DocumentContext dc = appender.writingDocument()) {
// this should be performed as quickly as possible because a write lock is held until
the
// DocumentContext is closed by the try-with-resources, this blocks other appenders
and tailers.
}
writingDocument in interface DocumentWrittenwritingDocument in interface MarshallableOutDocumentContext acquireWritingDocument(boolean metaData)
MarshallableOutacquireWritingDocument in interface DocumentWrittenacquireWritingDocument in interface MarshallableOutdefault void writeNotCompleteDocument(boolean metaData,
@NotNull
@NotNull WriteMarshallable writer)
throws net.openhft.chronicle.core.io.InvalidMarshallableException
This is used in networking, but no longer used in queue.
metaData - true if the write should write metaData rather than datawriter - writes bytes to the wirenet.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()
Copyright © 2023. All rights reserved.