Class HttpClient.BodySuppliers

  • Enclosing interface:
    HttpClient

    public static final class HttpClient.BodySuppliers
    extends Object
    Utility class for creating different body suppliers.
    • Method Detail

      • ofString

        public static IOSupplier<? extends InputStream> ofString​(String body)
        Creates a body supplier of the provided string.
        Parameters:
        body - the string body
        Returns:
        the supplier
      • ofString

        public static IOSupplier<? extends InputStream> ofString​(String body,
                                                                 Charset charset)
        Creates a body supplier of the provided string and charset.
        Parameters:
        body - the string body
        charset - the charset to use
        Returns:
        the supplier
      • ofBytes

        public static IOSupplier<? extends InputStream> ofBytes​(byte[] body)
        Creates a body supplier of the provided byte array.
        Parameters:
        body - the byte array
        Returns:
        the supplier