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, wait
forEach, spliterator
protected boolean isUsed
protected abstract Iterator<Document> iteratorDerived()
protected void closeDerived() throws OjaiException
OjaiException
protected 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()
DocumentStream
Document
.iterator
in interface Iterable<Document>
iterator
in interface DocumentStream
public final void close() throws OjaiException
DocumentStream
.
If a derived class requires any closing steps, it should override closeDerived()
.close
in interface AutoCloseable
close
in interface DocumentStream
OjaiException
protected Iterable<DocumentReader> documentReadersDerived()
public final Iterable<DocumentReader> documentReaders()
DocumentStream
Iterable
over a set of DocumentReader
.documentReaders
in interface DocumentStream
public void streamTo(DocumentListener docListener)
DocumentStream
DocumentStream
to the specified
listener.streamTo
in interface DocumentStream
docListener
- a DocumentListener
which is notified of
Document
s as they arriveCopyright © 2015–2018 MapR Technologies, Inc.. All rights reserved.