public class MwLocalDumpFile extends Object implements MwDumpFile
MwDumpFile.DateComparator
Constructor and Description |
---|
MwLocalDumpFile(String filepath)
Constructor.
|
MwLocalDumpFile(String filePath,
DumpContentType dumpContentType,
String dateStamp,
String projectName)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
String |
getDateStamp()
Returns the date stamp for this dump.
|
DumpContentType |
getDumpContentType()
Returns information about the content of the dump.
|
BufferedReader |
getDumpFileReader()
Returns a buffered reader that provides access to the (uncompressed) text
content of the dump file.
|
InputStream |
getDumpFileStream()
Returns an input stream that provides access to the (uncompressed) text
content of the dump file.
|
Path |
getPath()
Returns the absolute path to this dump file.
|
String |
getProjectName()
Returns the project name for this dump.
|
boolean |
isAvailable()
Checks if the dump is actually available.
|
void |
prepareDumpFile()
Prepares the dump file for access via
MwDumpFile.getDumpFileStream() or
MwDumpFile.getDumpFileReader() . |
String |
toString() |
public MwLocalDumpFile(String filepath)
filepath
- Path to the dump file in the file systempublic MwLocalDumpFile(String filePath, DumpContentType dumpContentType, String dateStamp, String projectName)
filePath
- Path to the dump file in the file systemdumpContentType
- DumpContentType of the dump file, or null if not known to
guess it from file name; this information is essential to
invoke the correct processing code to read the dump filedateStamp
- dump date in format YYYYMMDD, or null if not known to guess it
from file name; this is mainly used for logs and messagesprojectName
- project name string, or null to use a default string; this is
mainly used for logs and messagespublic Path getPath()
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 String getProjectName()
MwDumpFile
getProjectName
in interface MwDumpFile
public String getDateStamp()
MwDumpFile
getDateStamp
in interface MwDumpFile
public DumpContentType getDumpContentType()
MwDumpFile
getDumpContentType
in interface MwDumpFile
public InputStream getDumpFileStream() throws IOException
MwDumpFile
It is important to close the stream after use.
getDumpFileStream
in interface MwDumpFile
IOException
- if the dump file contents could not be accessedpublic 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 accessedpublic void prepareDumpFile()
MwDumpFile
MwDumpFile.getDumpFileStream()
or
MwDumpFile.getDumpFileReader()
. In particular, this will download any
remote files.prepareDumpFile
in interface MwDumpFile
Copyright © 2014–2024 Wikidata Toolkit Developers. Generated from source code published under the Apache License 2.0. For more information, see the Wikidata Toolkit homepage