Class ResourceInstaller.Limits.Builder

java.lang.Object
opennlp.tools.util.ResourceInstaller.Limits.Builder
Enclosing class:
ResourceInstaller.Limits

public static final class ResourceInstaller.Limits.Builder extends Object
Collects limit values and validates them on build(). Each setter returns this builder. Not thread safe; the ResourceInstaller.Limits it builds is immutable.
Since:
3.0.0
  • Method Details

    • connectTimeout

      public ResourceInstaller.Limits.Builder connectTimeout(Duration connectTimeout)
      Sets how long to wait for a connection to be established.
      Parameters:
      connectTimeout - How long to wait for a connection to be established. Must be positive.
      Returns:
      This builder. Not null.
    • readTimeout

      public ResourceInstaller.Limits.Builder readTimeout(Duration readTimeout)
      Sets how long to wait for data on an established connection.
      Parameters:
      readTimeout - How long to wait for data on an established connection. Must be positive.
      Returns:
      This builder. Not null.
    • maxRedirects

      public ResourceInstaller.Limits.Builder maxRedirects(int maxRedirects)
      Sets how many http redirects to follow before failing.
      Parameters:
      maxRedirects - How many http redirects to follow before failing. Must not be negative; zero rejects all redirects.
      Returns:
      This builder. Not null.
    • maxDownloadBytes

      public ResourceInstaller.Limits.Builder maxDownloadBytes(long maxDownloadBytes)
      Sets the largest download accepted.
      Parameters:
      maxDownloadBytes - The largest download accepted, in bytes. Must be positive.
      Returns:
      This builder. Not null.
    • maxExpandedBytes

      public ResourceInstaller.Limits.Builder maxExpandedBytes(long maxExpandedBytes)
      Sets the largest expanded byte count accepted.
      Parameters:
      maxExpandedBytes - The largest expanded byte count accepted. For gzip content, this counts the entire decompressed stream; otherwise, it counts installed file content. Must be positive.
      Returns:
      This builder. Not null.
    • maxEntries

      public ResourceInstaller.Limits.Builder maxEntries(long maxEntries)
      Sets the largest number of archive entries accepted.
      Parameters:
      maxEntries - The largest number of archive entries accepted, counting every entry including directories. Must be positive.
      Returns:
      This builder. Not null.
    • maxExpansionRatio

      public ResourceInstaller.Limits.Builder maxExpansionRatio(long maxExpansionRatio)
      Sets the largest expanded size accepted per compressed byte of a source.
      Parameters:
      maxExpansionRatio - The largest expanded size accepted per compressed byte of a source. Must be positive.
      Returns:
      This builder. Not null.
    • build

      public ResourceInstaller.Limits build()
      Builds the limits.
      Returns:
      The limits collected so far. Not null.
      Throws:
      IllegalArgumentException - Thrown if any value is outside its documented range.