Module http.client.ext
Package io.github.nstdio.http.ext
Class BodyHandlers.DecompressingBodyHandlerBuilder
- java.lang.Object
-
- io.github.nstdio.http.ext.BodyHandlers.DecompressingBodyHandlerBuilder
-
- Enclosing class:
- BodyHandlers
public static final class BodyHandlers.DecompressingBodyHandlerBuilder extends java.lang.Object
The builder for decompressing body handler.
-
-
Constructor Summary
Constructors Constructor Description DecompressingBodyHandlerBuilder()
Creates theDecompressingBodyHandlerBuilder
instance withfailOnUnsupportedDirectives
andfailOnUnknownDirectives
enabled.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.net.http.HttpResponse.BodyHandler<java.io.InputStream>
build()
Creates the new decompressing body handler.<T> java.net.http.HttpResponse.BodyHandler<T>
build(java.net.http.HttpResponse.BodyHandler<T> downstream)
Creates the new decompressing body handler.BodyHandlers.DecompressingBodyHandlerBuilder
failOnUnknownDirectives(boolean failOnUnknownDirectives)
Sets whether throw exception when unknown compression directive encountered or not.BodyHandlers.DecompressingBodyHandlerBuilder
failOnUnsupportedDirectives(boolean failOnUnsupportedDirectives)
Sets whether throw exception when compression directive not supported or not.BodyHandlers.DecompressingBodyHandlerBuilder
lenient(boolean lenient)
Toggles bothfailOnUnsupportedDirectives
andfailOnUnknownDirectives
.
-
-
-
Method Detail
-
failOnUnsupportedDirectives
public BodyHandlers.DecompressingBodyHandlerBuilder failOnUnsupportedDirectives(boolean failOnUnsupportedDirectives)
Sets whether throw exception when compression directive not supported or not.- Parameters:
failOnUnsupportedDirectives
- Whether throw exception when compression directive not supported or not- Returns:
- this for fluent chaining.
-
failOnUnknownDirectives
public BodyHandlers.DecompressingBodyHandlerBuilder failOnUnknownDirectives(boolean failOnUnknownDirectives)
Sets whether throw exception when unknown compression directive encountered or not.- Parameters:
failOnUnknownDirectives
- Whether throw exception when unknown compression directive encountered or not- Returns:
- this for fluent chaining.
-
lenient
public BodyHandlers.DecompressingBodyHandlerBuilder lenient(boolean lenient)
Toggles bothfailOnUnsupportedDirectives
andfailOnUnknownDirectives
.- Parameters:
lenient
- The lenient mode.- Returns:
- this for fluent chaining.
-
build
public java.net.http.HttpResponse.BodyHandler<java.io.InputStream> build()
Creates the new decompressing body handler.- Returns:
- The builder for decompressing body handler.
-
build
public <T> java.net.http.HttpResponse.BodyHandler<T> build(java.net.http.HttpResponse.BodyHandler<T> downstream)
Creates the new decompressing body handler.Please use
build()
ifdownstream
isHttpResponse.BodyHandlers.ofInputStream()
.- Type Parameters:
T
- The type of the response body.- Parameters:
downstream
- The downstream handler.- Returns:
- The builder for decompressing body handler.
-
-