Class WarcCapture

java.lang.Object
org.netpreserve.jwarc.WarcCapture

public class WarcCapture extends Object
Represents a capture event in a WARC file, which consists of one or more sequential WARC records linked by WARC-Concurrent-To headers.

EXPERIMENTAL API: May change or be removed without notice.

  • Method Details

    • target

      public String target()
    • targetURI

      public URI targetURI()
    • date

      public Instant date()
    • method

      public Optional<String> method()
      Returns the HTTP request method, if available.
    • status

      public Optional<Integer> status()
      Returns the HTTP response status code, if available.
    • contentType

      public Optional<MediaType> contentType()
      Returns the content type of the payload, if available.
    • record

      public WarcCaptureRecord record() throws IOException
      Returns the main WARC capture record for the current capture event. This will typically be the resource, response or revisit record. If none of these are present, returns the first record in the capture event.
      Throws:
      IOException
    • records

      public List<WarcCaptureRecord> records() throws IOException
      Returns the list of all WARC records associated with this capture event.
      Throws:
      IOException
    • metadata

      public Optional<WarcMetadata> metadata() throws IOException
      Returns the first metadata record associated with the current capture event, if present.
      Returns:
      an Optional containing the WARC metadata record if found, otherwise an empty Optional.
      Throws:
      IOException - if an error occurs while reading WARC records.
    • request

      public Optional<WarcRequest> request() throws IOException
      Returns the first request record associated with the current capture event, if present.
      Returns:
      an Optional containing the WARC request record if found, otherwise an empty Optional.
      Throws:
      IOException - if an error occurs while reading WARC records.
    • warcinfo

      public Optional<Warcinfo> warcinfo() throws IOException
      Returns the warcinfo record associated with the current capture event, if present.
      Throws:
      IOException