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 ArrayList<String> |
FilesToProcess
The list of files to process.
|
protected com.google.gson.JsonStreamParser |
JSONStream
The JSON stream containing the tweets
|
protected static org.apache.log4j.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(String CollectionSpecFile) |
Modifier and Type | Method and Description |
---|---|
protected 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() |
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.apache.log4j.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 void init()
public void loadJSON(String file) throws IOException
IOException
protected 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 4.0. Copyright © 2004-2014 University of Glasgow