Package org.wikidata.wdtk.dumpfiles.wmf
Class WmfLocalDumpFile
java.lang.Object
org.wikidata.wdtk.dumpfiles.wmf.WmfDumpFile
org.wikidata.wdtk.dumpfiles.wmf.WmfLocalDumpFile
- All Implemented Interfaces:
MwDumpFile
Class for representing dump files published by the Wikimedia Foundation, and
previously downloaded to a local directory.
- Author:
- Markus Kroetzsch
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.wikidata.wdtk.dumpfiles.MwDumpFile
MwDumpFile.DateComparator
-
Field Summary
Fields inherited from class org.wikidata.wdtk.dumpfiles.wmf.WmfDumpFile
dateStamp, DUMP_SITE_BASE_URL, projectName
-
Constructor Summary
ConstructorDescriptionWmfLocalDumpFile
(String dateStamp, String projectName, DirectoryManager dumpfileDirectoryManager, DumpContentType dumpContentType) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Finds out if the dump is ready.Returns information about the content of the dump.Returns the directory where this dump file data should be.Returns an input stream that provides access to the (uncompressed) text content of the dump file.void
Prepares the dump file for access viaMwDumpFile.getDumpFileStream()
orMwDumpFile.getDumpFileReader()
.Methods inherited from class org.wikidata.wdtk.dumpfiles.wmf.WmfDumpFile
getDateStamp, getDateStampFromDumpFileDirectoryName, getDumpFileCompressionType, getDumpFileDirectoryName, getDumpFileName, getDumpFilePostfix, getDumpFileReader, getDumpFileWebDirectory, getProjectName, isAvailable, isRevisionDumpFile, toString
-
Constructor Details
-
WmfLocalDumpFile
public WmfLocalDumpFile(String dateStamp, String projectName, DirectoryManager dumpfileDirectoryManager, DumpContentType dumpContentType) Constructor.- Parameters:
dateStamp
- dump date in format YYYYMMDDprojectName
- project name stringdumpfileDirectoryManager
- the directory manager for the directory where dumps should be downloaded todumpContentType
- the type of dump this represents
-
-
Method Details
-
getDumpfileDirectory
Returns the directory where this dump file data should be.- Returns:
- string representation of the directory of this dumpfile
-
getDumpContentType
Description copied from interface:MwDumpFile
Returns information about the content of the dump. Together with the project name and date stamp, this identifies the dump, and it is therefore always available.- Returns:
- the content type of this dump
-
getDumpFileStream
Description copied from interface:MwDumpFile
Returns an input stream that provides access to the (uncompressed) text content of the dump file.It is important to close the stream after use.
- Returns:
- an input stream to read the dump file
- Throws:
IOException
- if the dump file contents could not be accessed
-
prepareDumpFile
public void prepareDumpFile()Description copied from interface:MwDumpFile
Prepares the dump file for access viaMwDumpFile.getDumpFileStream()
orMwDumpFile.getDumpFileReader()
. In particular, this will download any remote files. -
fetchIsDone
protected boolean fetchIsDone()Description copied from class:WmfDumpFile
Finds out if the dump is ready. For online dumps, this should return true if the file can be fetched from the Web. For local dumps, this should return true if the file is complete and not corrupted. For some types of dumps, there are ways of checking this easily (i.e., without reading the full file). If this is not possible, then the method should just return "true."- Specified by:
fetchIsDone
in classWmfDumpFile
- Returns:
- true if the dump is done
-