Class JsonOnlineDumpFile

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

public class JsonOnlineDumpFile extends WmfDumpFile
  • Constructor Details

    • JsonOnlineDumpFile

      public JsonOnlineDumpFile(String dateStamp, String projectName, WebResourceFetcher webResourceFetcher, DirectoryManager dumpfileDirectoryManager)
      Constructor. Currently only "wikidatawiki" is supported as a project name, since the dumps are placed under a non-systematic directory structure that must be hard-coded for each project.
      Parameters:
      dateStamp - dump date in format YYYYMMDD
      projectName - project name string (e.g. "wikidatawiki")
      webResourceFetcher - object to use for accessing the web
      dumpfileDirectoryManager - the directory manager for the directory where dumps should be downloaded to
  • Method Details

    • 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() throws IOException
      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.
      Throws:
      IOException - if there was a problem preparing the 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