public class WARC018Collection extends Object implements Collection
Document
class to be used can be specified with the
trec.document.class property.
Properties
Document
class to parse individual documents (defaults to TaggedDocument
).Modifier and Type | Field and Description |
---|---|
protected long |
currentDocumentBlobLength
the length of the blob containing the document data
|
protected String |
desiredEncoding
Encoding to be used to open all files.
|
protected Map<String,String> |
DocProperties
properties for the current document
|
protected Class<? extends Document> |
documentClass
Class to use for all documents parsed by this class
|
protected int |
documentsInThisFile
Counts the number of documents that have been found in this file.
|
protected boolean |
eoc
are we at the end of the collection?
|
protected boolean |
eof
has the end of the current input file been reached?
|
protected int |
FileNumber
The index in the FilesToProcess of the currently processed file.
|
protected ArrayList<String> |
FilesToProcess
The list of files to process.
|
protected boolean |
forceUTF8
should UTF8 encoding be assumed?
|
protected InputStream |
is
the input stream of the current input file
|
protected static org.apache.log4j.Logger |
logger
logger for this class
|
protected Tokeniser |
tokeniser
Tokeniser to use for all documents parsed by this class
|
protected String |
warc_crawldate_header
what header for the crawldate document metadata
|
protected String |
warc_docno_header
what header for the docno document metadata
|
protected String |
warc_url_header
what header for the url document metadata
|
Constructor and Description |
---|
WARC018Collection()
default constructor for this collection object.
|
WARC018Collection(InputStream input)
A constructor that reads only the specificed InputStream.
|
WARC018Collection(String CollectionSpecFilename)
construct a collection from the denoted collection.spec file
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the collection, any files that may be open.
|
boolean |
endOfCollection()
Returns true if the end of the collection has been reached
|
String |
getDocid()
Get the String document identifier of the current document.
|
Document |
getDocument()
Get the document object representing the current document.
|
boolean |
hasNext()
Check whether it is the last document in the collection
|
protected void |
loadDocumentClass()
Loads the class that will supply all documents for this Collection.
|
Document |
next()
Return the next document
|
boolean |
nextDocument()
Move the collection to the start of the next document.
|
protected boolean |
openNextFile()
Opens the next document from the collection specification.
|
protected int |
parseHeaders(boolean requireContentLength) |
protected void |
readCollectionSpec(String CollectionSpecFilename)
read in the collection.spec
|
protected String |
readLine()
read a line from the currently open InputStream is
|
void |
reset()
Resets the Collection iterator to the start of the collection.
|
protected static final org.apache.log4j.Logger logger
protected int documentsInThisFile
protected boolean eoc
protected boolean eof
protected InputStream is
protected long currentDocumentBlobLength
protected int FileNumber
protected final boolean forceUTF8
protected final String warc_docno_header
protected final String warc_url_header
protected final String warc_crawldate_header
protected String desiredEncoding
protected Class<? extends Document> documentClass
protected Tokeniser tokeniser
public WARC018Collection()
public WARC018Collection(String CollectionSpecFilename)
public WARC018Collection(InputStream input)
public boolean hasNext()
public Document next()
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public boolean endOfCollection()
endOfCollection
in interface Collection
public String getDocid()
protected void loadDocumentClass()
public Document getDocument()
getDocument
in interface Collection
protected int parseHeaders(boolean requireContentLength) throws IOException
IOException
public boolean nextDocument()
nextDocument
in interface Collection
protected String readLine() throws IOException
IOException
protected boolean openNextFile() throws IOException
IOException
- if there is an exception while opening the
collection files.protected void readCollectionSpec(String CollectionSpecFilename)
public void reset()
reset
in interface Collection
Terrier 4.0. Copyright © 2004-2014 University of Glasgow