Class WmfLocalDumpFile

java.lang.Object
org.wikidata.wdtk.dumpfiles.wmf.WmfDumpFile
org.wikidata.wdtk.dumpfiles.wmf.WmfLocalDumpFile
All Implemented Interfaces:
MwDumpFile

public class WmfLocalDumpFile extends WmfDumpFile
Class for representing dump files published by the Wikimedia Foundation, and previously downloaded to a local directory.
Author:
Markus Kroetzsch
  • Constructor Details

    • WmfLocalDumpFile

      public WmfLocalDumpFile(String dateStamp, String projectName, DirectoryManager dumpfileDirectoryManager, DumpContentType dumpContentType)
      Constructor.
      Parameters:
      dateStamp - dump date in format YYYYMMDD
      projectName - project name string
      dumpfileDirectoryManager - the directory manager for the directory where dumps should be downloaded to
      dumpContentType - the type of dump this represents
  • Method Details

    • getDumpfileDirectory

      public String getDumpfileDirectory()
      Returns the directory where this dump file data should be.
      Returns:
      string representation of the directory of this dumpfile
    • getDumpContentType

      public DumpContentType 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

      public InputStream getDumpFileStream() throws IOException
      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 via MwDumpFile.getDumpFileStream() or MwDumpFile.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 class WmfDumpFile
      Returns:
      true if the dump is done