public abstract class WmfDumpFile extends Object implements MwDumpFile
MwDumpFile.DateComparator
Modifier and Type | Field and Description |
---|---|
protected String |
dateStamp |
protected static String |
DUMP_SITE_BASE_URL
The default URL of the website to obtain the dump files from.
|
protected String |
projectName |
Constructor and Description |
---|
WmfDumpFile(String dateStamp,
String projectName) |
Modifier and Type | Method and Description |
---|---|
protected abstract boolean |
fetchIsDone()
Finds out if the dump is ready.
|
String |
getDateStamp()
Returns the date stamp for this dump.
|
static String |
getDateStampFromDumpFileDirectoryName(DumpContentType dumpContentType,
String directoryName)
Extracts the date stamp from a dumpfile directory name in the form that
is created by
getDumpFileDirectoryName(DumpContentType, String) . |
static CompressionType |
getDumpFileCompressionType(String fileName)
Returns the compression type of this kind of dump file using file suffixes
|
static String |
getDumpFileDirectoryName(DumpContentType dumpContentType,
String dateStamp)
Returns the name of the directory where the dumpfile of the given type
and date should be stored.
|
static String |
getDumpFileName(DumpContentType dumpContentType,
String projectName,
String dateStamp)
Returns the name under which this dump file.
|
static String |
getDumpFilePostfix(DumpContentType dumpContentType)
Returns the ending used by the Wikimedia-provided dumpfile names of the
given type.
|
BufferedReader |
getDumpFileReader()
Returns a buffered reader that provides access to the (uncompressed) text
content of the dump file.
|
static String |
getDumpFileWebDirectory(DumpContentType dumpContentType,
String projectName)
Returns the absolute directory on the Web site where dumpfiles of the
given type can be found.
|
String |
getProjectName()
Returns the project name for this dump.
|
boolean |
isAvailable()
Checks if the dump is actually available.
|
static boolean |
isRevisionDumpFile(DumpContentType dumpContentType)
Returns true if the given dump file type contains page revisions and
false if it does not.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getDumpContentType, getDumpFileStream, prepareDumpFile
protected static final String DUMP_SITE_BASE_URL
protected final String dateStamp
protected final String projectName
public String getProjectName()
MwDumpFile
getProjectName
in interface MwDumpFile
public String getDateStamp()
MwDumpFile
getDateStamp
in interface MwDumpFile
public boolean isAvailable()
MwDumpFile
MwDumpFile.getDumpFileReader()
. Depending on the type of dumpfile, this
will trigger one or more checks to make sure that all relevant data can
be accessed for this dump file. This is still no definite guarantee that
the download will succeed, since there can always be IO errors anyway,
but it helps to detect cases where the dump is clearly not in a usable
state.isAvailable
in interface MwDumpFile
public BufferedReader getDumpFileReader() throws IOException
MwDumpFile
It is important to close the reader after use.
getDumpFileReader
in interface MwDumpFile
IOException
- if the dump file contents could not be accessedprotected abstract boolean fetchIsDone()
public static String getDumpFilePostfix(DumpContentType dumpContentType)
dumpContentType
- the type of dumpIllegalArgumentException
- if the given dump file type is not knownpublic static String getDumpFileWebDirectory(DumpContentType dumpContentType, String projectName)
dumpContentType
- the type of dumpIllegalArgumentException
- if the given dump file type is not knownpublic static CompressionType getDumpFileCompressionType(String fileName)
fileName
- the name of the fileIllegalArgumentException
- if the given dump file type is not knownpublic static String getDumpFileDirectoryName(DumpContentType dumpContentType, String dateStamp)
dumpContentType
- the type of the dumpdateStamp
- the date of the dump in format YYYYMMDDpublic static String getDateStampFromDumpFileDirectoryName(DumpContentType dumpContentType, String directoryName)
getDumpFileDirectoryName(DumpContentType, String)
.
It is not checked that the given directory name has the right format; if
it has not, the result will not be a date stamp but some other string.dumpContentType
- directoryName
- public static String getDumpFileName(DumpContentType dumpContentType, String projectName, String dateStamp)
dumpContentType
- the type of the dumpprojectName
- the project name, e.g. "wikidatawiki"dateStamp
- the date of the dump in format YYYYMMDDpublic static boolean isRevisionDumpFile(DumpContentType dumpContentType)
dumpContentType
- the type of dumpIllegalArgumentException
- if the given dump file type is not knownCopyright © 2014–2024 Wikidata Toolkit Developers. Generated from source code published under the Apache License 2.0. For more information, see the Wikidata Toolkit homepage