public abstract class DocumentStreamBase extends Object implements DocumentStream
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
isUsed
Indicates that one of documentReaders(), iterator(), or streamTo() has been called.
|
| Constructor and Description |
|---|
DocumentStreamBase() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkAndSetInUse()
Checks to see that the state is valid (open, not canceled or closed) for requesting
data.
|
protected void |
checkOpen()
Checks to see if the stream is open or not.
|
void |
close()
Closes this
DocumentStream.
If a derived class requires any closing steps, it should override closeDerived(). |
protected void |
closeDerived()
Perform whatever steps the derived class requires for closing.
|
Iterable<DocumentReader> |
documentReaders()
Returns an
Iterable over a set of DocumentReader. |
protected Iterable<DocumentReader> |
documentReadersDerived() |
protected boolean |
isClosed() |
Iterator<Document> |
iterator()
Returns an iterator over a set of
Document. |
protected abstract Iterator<Document> |
iteratorDerived()
This is the only method deriving class MUST implement.
|
void |
streamTo(DocumentListener docListener)
Streams all the documents in this
DocumentStream to the specified
listener. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorprotected boolean isUsed
protected abstract Iterator<Document> iteratorDerived()
protected void closeDerived()
throws OjaiException
OjaiExceptionprotected void checkOpen()
IllegalStateException - if the stream has been closedprotected void checkAndSetInUse()
IllegalStateException - if the stream is closed or if one of the data retrieval
methods (documentReaders(), iterator(), or streamTo()) has been used once alreadyprotected boolean isClosed()
public final Iterator<Document> iterator()
DocumentStreamDocument.iterator in interface Iterable<Document>iterator in interface DocumentStreampublic final void close()
throws OjaiException
DocumentStream.
If a derived class requires any closing steps, it should override closeDerived().close in interface AutoCloseableclose in interface DocumentStreamOjaiExceptionprotected Iterable<DocumentReader> documentReadersDerived()
public final Iterable<DocumentReader> documentReaders()
DocumentStreamIterable over a set of DocumentReader.documentReaders in interface DocumentStreampublic void streamTo(DocumentListener docListener)
DocumentStreamDocumentStream to the specified
listener.streamTo in interface DocumentStreamdocListener - a DocumentListener which is notified of
Documents as they arriveCopyright © 2015–2019 MapR Technologies, Inc.. All rights reserved.