Class WarcTargetRecord

Direct Known Subclasses:
WarcCaptureRecord, WarcContinuation, WarcConversion

public abstract class WarcTargetRecord extends WarcRecord
A WARC record associated with some target URI.

This class exists solely to differentiate between the Warcinfo record type and all the other standard record types.

  • Method Details

    • target

      public String target()
      The URI of the original target resource this record holds information about as an unparsed string.

      Strips enclosing angle brackets if present as a compatibility quirk with WARC 1.0.

    • targetURI

      public URI targetURI()
      The URI of the original target resource this record holds information about.

      This method uses URIs.parseLeniently() to percent encode characters that are rejected by the URI class and so may return a value that is not identical to the value of the WARC-Target-URI field. Using target() should be preferred unless you actually need an instance of the URI class.

    • payloadDigest

      public Optional<WarcDigest> payloadDigest()
      Digest values that were calculated by applying hash functions to payload.
    • identifiedPayloadType

      public Optional<MediaType> identifiedPayloadType()
      A content-type that was identified by an independent check (not just what the server said).
    • payload

      public Optional<WarcPayload> payload() throws IOException
      Returns the payload of this record if one is present.

      This method returns an empty optional when the payload is undefined for this record type or if this library does not know how to parse the body in order to extract the payload. If the payload is well defined but happens to be zero bytes in length this method still returns a WarcPayload object.

      Throws:
      IOException
    • warcinfoID

      public Optional<URI> warcinfoID()
      The ID of a Warcinfo record associated with this record.
    • toString

      public String toString()
      Overrides:
      toString in class WarcRecord