Class ResourceInstaller.Limits.Builder
java.lang.Object
opennlp.tools.util.ResourceInstaller.Limits.Builder
- Enclosing class:
ResourceInstaller.Limits
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 Summary
Modifier and TypeMethodDescriptionbuild()Builds the limits.connectTimeout(Duration connectTimeout) Sets how long to wait for a connection to be established.maxDownloadBytes(long maxDownloadBytes) Sets the largest download accepted.maxEntries(long maxEntries) Sets the largest number of archive entries accepted.maxExpandedBytes(long maxExpandedBytes) Sets the largest expanded byte count accepted.maxExpansionRatio(long maxExpansionRatio) Sets the largest expanded size accepted per compressed byte of a source.maxRedirects(int maxRedirects) Sets how many http redirects to follow before failing.readTimeout(Duration readTimeout) Sets how long to wait for data on an established connection.
-
Method Details
-
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
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
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
Sets the largest download accepted.- Parameters:
maxDownloadBytes- The largest download accepted, in bytes. Must be positive.- Returns:
- This builder. Not
null.
-
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
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
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
Builds the limits.- Returns:
- The limits collected so far. Not
null. - Throws:
IllegalArgumentException- Thrown if any value is outside its documented range.
-