- All Known Implementing Classes:
BrotliBodyDecoderFactory
,DeflateBodyDecoderFactory
,GzipBodyDecoderFactory
- Enclosing interface:
BodyDecoder<T>
public static interface BodyDecoder.Factory
A factory of
BodyDecoder
instances for some defined encoding.
BodyDecoder.Factory
implementations are registered as service-providers by means described in
the ServiceLoader
class.-
Method Summary
Modifier and TypeMethodDescription<T> BodyDecoder
<T> create
(HttpResponse.BodySubscriber<T> downstream) Creates aBodyDecoder
with the given downstream.<T> BodyDecoder
<T> create
(HttpResponse.BodySubscriber<T> downstream, Executor executor) Creates aBodyDecoder
with the given downstream and executor.encoding()
Returns the encoding used byBodyDecoders
created by this factory.static Optional
<BodyDecoder.Factory> getFactory
(String encoding) Returns the factory registered for the given encoding, if any.static Map
<String, BodyDecoder.Factory> Returns an immutable map that case-insensitively maps encodings to their corresponding registered factories.static List
<BodyDecoder.Factory> Returns an immutable list of the registered factories.
-
Method Details
-
encoding
String encoding()Returns the encoding used byBodyDecoders
created by this factory. -
create
Creates aBodyDecoder
with the given downstream. -
create
Creates aBodyDecoder
with the given downstream and executor. -
installedFactories
Returns an immutable list of the registered factories.- Throws:
ServiceConfigurationError
- if an error occurs while loading the registered factories
-
installedBindings
Returns an immutable map that case-insensitively maps encodings to their corresponding registered factories. If more than one factory is registered for a given encoding, it is unspecified which one ends up being in the map. However, decoders provided by this module are guaranteed to be overridden by ones registered by other modules for the same encoding. -
getFactory
Returns the factory registered for the given encoding, if any.
-