public class BinaryReadDocumentContext extends Object implements ReadDocumentContext
| Modifier and Type | Field and Description |
|---|---|
long |
lastStart |
protected boolean |
metaData |
protected boolean |
notComplete |
protected boolean |
present |
protected long |
readLimit |
protected long |
readPosition |
protected boolean |
rollback |
long |
start |
protected @Nullable AbstractWire |
wire |
NOOP| Constructor and Description |
|---|
BinaryReadDocumentContext(@Nullable Wire wire)
Constructor that initializes the BinaryReadDocumentContext using the provided wire.
|
BinaryReadDocumentContext(@Nullable Wire wire,
boolean ensureFullRead)
Constructor that initializes the BinaryReadDocumentContext using the provided wire and
a flag to determine if a full read should be ensured.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the
DocumentContext and releases any held resources. |
void |
closeReadLimit(long readLimit)
Sets the read limit for this
ReadDocumentContext. |
void |
closeReadPosition(long readPosition)
Sets the read position for this
ReadDocumentContext. |
long |
index()
Obtains the index of the last read operation from this source context.
|
boolean |
isMetaData()
Checks it the
DocumentContext is metadata. |
boolean |
isNotComplete() |
boolean |
isPresent()
Checks if the
DocumentContext is present. |
void |
reset()
Cleans up the
DocumentContext by invoking the close method, then discarding
any lingering state associated with it. |
protected boolean |
rollback()
Determines if a rollback is required for this document context.
|
protected boolean |
rollbackIfNeeded()
Rolls back the document context to its state before opening, if the rollback marker is set.
|
void |
rollbackOnClose()
Invoked to signal an error condition in the current context.
|
void |
setStart(long start)
Sets the start position of the document context and updates the last start position.
|
int |
sourceId()
Retrieves the source ID associated with this context.
|
void |
start()
Initiates the start of reading within the context.
|
String |
toString() |
@Nullable Wire |
wire()
Returns the
Wire associated with the Document. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitisData, isOpen, rollbackIfNotCompletepublic long start
public long lastStart
@Nullable protected @Nullable AbstractWire wire
protected boolean present
protected boolean notComplete
protected long readPosition
protected long readLimit
protected boolean metaData
protected boolean rollback
public BinaryReadDocumentContext(@Nullable
@Nullable Wire wire)
wire - The wire used for reading the document.public BinaryReadDocumentContext(@Nullable
@Nullable Wire wire,
boolean ensureFullRead)
wire - The wire used for reading the document.ensureFullRead - Flag to determine if full reading is required.public boolean isMetaData()
DocumentContextDocumentContext is metadata. If it is, true is
returned, otherwise false.isMetaData in interface DocumentContextpublic boolean isPresent()
DocumentContextDocumentContext is present. If it is, true is returned,
otherwise false.isPresent in interface DocumentContextpublic void closeReadPosition(long readPosition)
ReadDocumentContextReadDocumentContext.
This defines the starting point within the document from which reading should begin.closeReadPosition in interface ReadDocumentContextreadPosition - The long value representing the read position.public void closeReadLimit(long readLimit)
ReadDocumentContextReadDocumentContext.
This defines the boundary or endpoint within the document up to which reading should occur.closeReadLimit in interface ReadDocumentContextreadLimit - The long value representing the read limit.@Nullable public @Nullable 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 boolean rollback()
true if rollback is required, false otherwise.public 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 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 rollbackIfNeeded()
true if the context was rolled back, false otherwise.public void start()
ReadDocumentContextstart in interface ReadDocumentContextpublic long index()
SourceContextindex in interface SourceContextpublic int sourceId()
SourceContextsourceId in interface SourceContextpublic boolean isNotComplete()
isNotComplete in interface DocumentContextpublic void rollbackOnClose()
DocumentContextrollbackOnClose in interface DocumentContextpublic void setStart(long start)
start - The new starting position to set.Copyright © 2024. All rights reserved.