Class FetchOptions

java.lang.Object
org.netpreserve.jwarc.FetchOptions

public class FetchOptions extends Object
Options for fetching a remote resource.
See Also:
  • Constructor Details

    • FetchOptions

      public FetchOptions()
  • Method Details

    • maxLength

      public FetchOptions maxLength(long bytes)
      Stops the fetch after this many bytes are received (including any protocol headers). If this limit was reached the header "WARC-Truncated: length" will be added to the response record.
    • maxTime

      public FetchOptions maxTime(long millis)
      Stops the fetch after this many milliseconds have elapsed. If this limit was reached the header "WARC-Truncated: time" will be added to the response record.
    • readTimeout

      public FetchOptions readTimeout(int millis)
      Sets the read timeout in milliseconds on the socket. Defaults to 60000. Set to 0 for no timout.
      See Also:
    • userAgent

      public FetchOptions userAgent(String userAgent)
      Sets the User-Agent request header. Default: "jwarc"

      If a custom HTTP request is provided this option will be ignored.

    • copyTo

      public FetchOptions copyTo(OutputStream copyTo)
      If specified the response will also be copied to this OutputStream as well as the WARC file.