public class TwitterJSONCollection extends Object implements Collection
Modifier and Type | Field and Description |
---|---|
protected Document |
currentDocument
The current document
|
protected String |
currentFilename
The name of the current file
|
protected BufferedReader |
currentTweetStream
The underlying file stream reading tweets from the current file
|
protected boolean |
endOfCollection
Have we reached the end of the collection yet?
|
protected int |
FileNumber
The index in the FilesToProcess of the currently processed file.
|
protected List<String> |
FilesToProcess
The list of files to process.
|
protected com.google.gson.JsonStreamParser |
JSONStream
The JSON stream containing the tweets
|
protected static org.slf4j.Logger |
logger
logger for this class
|
protected boolean |
SkipFile
A boolean which is true when a new file is open.
|
Constructor and Description |
---|
TwitterJSONCollection() |
TwitterJSONCollection(List<String> files,
String ignored1,
String ignored2,
String ignored3) |
TwitterJSONCollection(String CollectionSpecFile) |
TwitterJSONCollection(String addressCollectionFilename,
String ignored1,
String ignored2,
String ignored3)
additional constructors required by TRECIndexing
|
Modifier and Type | Method and Description |
---|---|
void |
addFileToProcess(String JSONFile) |
void |
close() |
boolean |
endOfCollection()
Returns true if the end of the collection has been reached
|
Document |
getDocument()
Get the document object representing the current document.
|
void |
init() |
protected void |
loadJSON(String file) |
boolean |
nextDocument()
Move the collection to the start of the next document.
|
boolean |
openNextFile()
Opens the next document from the collection specification.
|
protected void |
readCollectionSpec(String CollectionSpecFilename) |
com.google.gson.JsonObject |
readTweet() |
void |
reset()
Resets the Collection iterator to the start of the collection.
|
protected static final org.slf4j.Logger logger
protected boolean SkipFile
protected com.google.gson.JsonStreamParser JSONStream
protected BufferedReader currentTweetStream
protected Document currentDocument
protected String currentFilename
protected int FileNumber
protected boolean endOfCollection
public TwitterJSONCollection(String CollectionSpecFile)
public TwitterJSONCollection()
public TwitterJSONCollection(String addressCollectionFilename, String ignored1, String ignored2, String ignored3)
public void init()
protected void loadJSON(String file) throws IOException
IOException
public void addFileToProcess(String JSONFile)
protected void readCollectionSpec(String CollectionSpecFilename)
public boolean openNextFile() throws IOException
IOException
- if there is an exception while opening the
collection files.public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public boolean nextDocument()
Collection
nextDocument
in interface Collection
public com.google.gson.JsonObject readTweet()
public Document getDocument()
Collection
getDocument
in interface Collection
public boolean endOfCollection()
Collection
endOfCollection
in interface Collection
public void reset()
Collection
reset
in interface Collection
Terrier Information Retrieval Platform 5.1. Copyright © 2004-2019, University of Glasgow