Module methanol

Interface BodyDecoder.Factory

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 Details

    • encoding

      String encoding()
      Returns the encoding used by BodyDecoders created by this factory.
    • create

      <T> BodyDecoder<T> create(HttpResponse.BodySubscriber<T> downstream)
      Creates a BodyDecoder with the given downstream.
    • create

      <T> BodyDecoder<T> create(HttpResponse.BodySubscriber<T> downstream, Executor executor)
      Creates a BodyDecoder with the given downstream and executor.
    • installedFactories

      static List<BodyDecoder.Factory> installedFactories()
      Returns an immutable list of the registered factories.
      Throws:
      ServiceConfigurationError - if an error occurs while loading the registered factories
    • installedBindings

      static Map<String,BodyDecoder.Factory> 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

      static Optional<BodyDecoder.Factory> getFactory(String encoding)
      Returns the factory registered for the given encoding, if any.