public class BinaryWriteDocumentContext extends Object implements WriteDocumentContext
| Modifier and Type | Field and Description |
|---|---|
protected int |
count |
protected long |
position |
protected int |
tmpHeader |
protected Wire |
wire |
NOOP| Constructor and Description |
|---|
BinaryWriteDocumentContext(Wire wire)
Constructs a new context for writing binary documents using the specified wire.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
chainedElement()
Returns
true if this WriteDocumentContext is a
chained element. |
void |
chainedElement(boolean chainedElement)
Marks this
WriteDocumentContext as a chained element. |
protected boolean |
checkResetOpened() |
void |
close()
Closes the
DocumentContext and releases any held resources. |
long |
index()
Obtains the index of the last read operation from this source context.
|
boolean |
isEmpty()
Checks if the writing context is empty.
|
boolean |
isMetaData()
Checks it the
DocumentContext is metadata. |
boolean |
isNotComplete() |
boolean |
isPresent()
Checks if the
DocumentContext is present. |
protected long |
position()
Retrieves the current position in the wire where the document starts.
|
void |
reset()
Cleans up the
DocumentContext by invoking the close method, then discarding
any lingering state associated with it. |
void |
rollbackIfNotComplete()
Call this if any incomplete message should be rolled back at this point, it it wasn't complete by now.
|
void |
rollbackOnClose()
Invoked to signal an error condition in the current context.
|
int |
sourceId()
Retrieves the source ID associated with this context.
|
void |
start(boolean metaData)
Initializes the context for starting a new binary write.
|
Wire |
wire()
Returns the
Wire associated with the Document. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisData, isOpenprotected Wire wire
protected long position
protected int tmpHeader
protected int count
public BinaryWriteDocumentContext(Wire wire)
wire - The wire instance to be used for the writing process.public void start(boolean metaData)
start in interface WriteDocumentContextmetaData - A flag indicating whether the write includes metadata.public boolean isEmpty()
WriteDocumentContextisEmpty in interface WriteDocumentContexttrue if the context is empty; otherwise, false.public boolean isMetaData()
DocumentContextDocumentContext is metadata. If it is, true is
returned, otherwise false.isMetaData in interface DocumentContextpublic void close()
DocumentContextDocumentContext and releases any held resources.
It is crucial to ensure that this method is invoked after the context's operations are completed
to prevent any potential resource leaks or data corruption.close in interface Closeableclose in interface AutoCloseableclose in interface DocumentContextpublic void rollbackIfNotComplete()
DocumentContextrollbackIfNotComplete in interface DocumentContextpublic void rollbackOnClose()
DocumentContextrollbackOnClose in interface DocumentContextpublic void reset()
DocumentContextDocumentContext by invoking the close method, then discarding
any lingering state associated with it. This provides a way to ensure the context
is in a fresh state and free of any residual data or settings.reset in interface DocumentContextprotected boolean checkResetOpened()
public boolean chainedElement()
WriteDocumentContexttrue if this WriteDocumentContext is a
chained element.chainedElement in interface WriteDocumentContexttrue if this WriteDocumentContext is a
chained element; otherwise, false.public void chainedElement(boolean chainedElement)
WriteDocumentContextWriteDocumentContext as a chained element.chainedElement in interface WriteDocumentContextchainedElement - A boolean value indicating if the context
is a chained element.public boolean isPresent()
DocumentContextDocumentContext is present. If it is, true is returned,
otherwise false.isPresent in interface DocumentContextpublic Wire wire()
DocumentContextWire associated with the Document. It is possible that
null is returned, depending on the implementation.wire in interface DocumentContextWire associated with the Document.protected long position()
public long index()
SourceContextindex in interface SourceContextpublic int sourceId()
SourceContextsourceId in interface SourceContextpublic boolean isNotComplete()
isNotComplete in interface DocumentContextCopyright © 2024. All rights reserved.