public class TextReadDocumentContext extends Object implements ReadDocumentContext
| Modifier and Type | Field and Description |
|---|---|
static net.openhft.chronicle.bytes.BytesStore<?,?> |
EOD_SEP |
protected boolean |
notComplete |
protected boolean |
present |
static net.openhft.chronicle.bytes.BytesStore<?,?> |
SOD_SEP |
protected @Nullable AbstractWire |
wire |
NOOP| Constructor and Description |
|---|
TextReadDocumentContext(@Nullable AbstractWire wire)
Constructor for the TextReadDocumentContext.
|
| 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. |
static void |
consumeToEndOfMessage(net.openhft.chronicle.bytes.Bytes<?> bytes)
Consumes the bytes until the end of the message is encountered.
|
long |
index()
Obtains the index of the last read operation from this source context.
|
static boolean |
isEndOfMessage(net.openhft.chronicle.bytes.Bytes<?> bytes)
Checks if the current position in the bytes denotes the end of a message.
|
boolean |
isMetaData()
Checks it the
DocumentContext is metadata. |
boolean |
isNotComplete() |
boolean |
isPresent()
Checks if the
DocumentContext is present. |
protected static boolean |
isWhiteSpaceAt(net.openhft.chronicle.bytes.Bytes<?> bytes)
Determines if the byte at a specific position (offset by 3 from current) is a whitespace.
|
void |
reset()
Cleans up the
DocumentContext by invoking the close method, then discarding
any lingering state associated with it. |
void |
rollbackOnClose()
Invoked to signal an error condition in the current context.
|
protected void |
skipSep(net.openhft.chronicle.bytes.Bytes<?> bytes)
Skips the document separator sequence (3 bytes) in the given bytes.
|
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 static final net.openhft.chronicle.bytes.BytesStore<?,?> SOD_SEP
public static final net.openhft.chronicle.bytes.BytesStore<?,?> EOD_SEP
@Nullable protected @Nullable AbstractWire wire
protected boolean present
protected boolean notComplete
public TextReadDocumentContext(@Nullable
@Nullable AbstractWire wire)
wire - The wire instance to be used by this context. Can be null.public static void consumeToEndOfMessage(net.openhft.chronicle.bytes.Bytes<?> bytes)
bytes - The bytes to be consumed.public static boolean isEndOfMessage(net.openhft.chronicle.bytes.Bytes<?> bytes)
bytes - The bytes to be checked.protected static boolean isWhiteSpaceAt(net.openhft.chronicle.bytes.Bytes<?> bytes)
bytes - The bytes to be checked.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.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 DocumentContextpublic void start()
ReadDocumentContextstart in interface ReadDocumentContextprotected void skipSep(net.openhft.chronicle.bytes.Bytes<?> bytes)
bytes - The bytes in which the separator sequence should be skipped.public void rollbackOnClose()
DocumentContextrollbackOnClose in interface DocumentContextpublic long index()
SourceContextindex in interface SourceContextpublic int sourceId()
SourceContextsourceId in interface SourceContextpublic boolean isNotComplete()
isNotComplete in interface DocumentContextCopyright © 2024. All rights reserved.