Class WARCReaderFactory.CompressedWARCReader

java.lang.Object
org.archive.io.ArchiveReader
org.archive.io.warc.WARCReader
org.archive.io.warc.WARCReaderFactory.CompressedWARCReader
All Implemented Interfaces:
Closeable, AutoCloseable, Iterable<ArchiveRecord>
Enclosing class:
WARCReaderFactory

public class WARCReaderFactory.CompressedWARCReader extends WARCReader
Compressed WARC file reader.
Version:
$Date: 2006-08-23 17:59:04 -0700 (Wed, 23 Aug 2006) $ $Version$
Author:
stack
  • Constructor Details

    • CompressedWARCReader

      public CompressedWARCReader(File f) throws IOException
      Constructor.
      Parameters:
      f - Compressed file to read.
      Throws:
      IOException
    • CompressedWARCReader

      public CompressedWARCReader(File f, long offset) throws IOException
      Constructor.
      Parameters:
      f - Compressed arcfile to read.
      offset - Position at where to start reading file.
      Throws:
      IOException
    • CompressedWARCReader

      public CompressedWARCReader(String f, InputStream is, boolean atFirstRecord) throws IOException
      Constructor.
      Parameters:
      f - Compressed arcfile.
      is - InputStream to use.
      atFirstRecord -
      Throws:
      IOException
  • Method Details

    • get

      public WARCRecord get(long offset) throws IOException
      Get record at passed offset.
      Overrides:
      get in class ArchiveReader
      Parameters:
      offset - Byte index into file at which a record starts.
      Returns:
      A WARCRecord reference.
      Throws:
      IOException
    • iterator

      public Iterator<ArchiveRecord> iterator()
      Description copied from class: ArchiveReader
      Returns an ArchiveRecord iterator. Of note, on IOException, especially if ZipException reading compressed ARCs, rather than fail the iteration, try moving to the next record. If ArchiveReader.strict is not set, this will usually succeed.
      Specified by:
      iterator in interface Iterable<ArchiveRecord>
      Overrides:
      iterator in class ArchiveReader
      Returns:
      An iterator over ARC records.
    • gotoEOR

      protected void gotoEOR(ArchiveRecord rec) throws IOException
      Description copied from class: WARCReader
      Skip over any trailing new lines at end of the record so we're lined up ready to read the next.
      Overrides:
      gotoEOR in class WARCReader
      Parameters:
      rec -
      Throws:
      IOException