T - Type of items in the streampublic abstract class AbstractTwitterStreamDataset<T> extends BlockingDroppingBufferedStream<T> implements StreamingDataset<T>
This class is abstract in terms of the object the stream consumes. Instances of this class can construct the specific object they require for each twitter status using:
| Constructor and Description |
|---|
AbstractTwitterStreamDataset(TwitterAPIToken token,
BlockingDroppingQueue<T> buffer)
Construct with the given Twitter API credentials and buffer
|
| Modifier and Type | Method and Description |
|---|---|
T |
getRandomInstance() |
int |
numInstances()
Returns the number of instances in this dataset.
|
protected abstract void |
registerStatus(twitter4j.Status status,
String json)
Handle the given incoming status and optionally
BlockingDroppingBufferedStream.register(Object)
it with the stream. |
close, getBuffer, hasNext, next, registerfilter, forEach, forEach, forEach, iterator, map, map, parallelForEach, parallelForEach, remove, transformclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfilter, forEach, forEach, forEach, map, map, parallelForEach, parallelForEach, transformforEachRemaining, hasNext, next, removeforEach, iterator, spliteratorpublic AbstractTwitterStreamDataset(TwitterAPIToken token, BlockingDroppingQueue<T> buffer)
token - the Twitter api authentication credentialsbuffer - the backing buffer for storing data before consumption from
the streamprotected abstract void registerStatus(twitter4j.Status status, String json) throws InterruptedException
BlockingDroppingBufferedStream.register(Object)
it with the stream.status - the parsed Statusjson - the json stringInterruptedExceptionpublic T getRandomInstance()
getRandomInstance in interface Dataset<T>public int numInstances()
DatasetnumInstances in interface Dataset<T>