Class HttpRequest.BodyPublishers

java.lang.Object
dev.gmitch215.bytebox.net.http.HttpRequest.BodyPublishers
Enclosing class:
HttpRequest

public static final class HttpRequest.BodyPublishers extends Object
The request bodies there are.
  • Method Details

    • ofString

      public static HttpRequest.BodyPublisher ofString(String body)
      A body of text.
      Parameters:
      body - the text, encoded as UTF-8
      Returns:
      the publisher
    • ofString

      public static HttpRequest.BodyPublisher ofString(String body, Charset charset)
      A body of text in a given encoding.
      Parameters:
      body - the text
      charset - how to encode it
      Returns:
      the publisher
    • ofByteArray

      public static HttpRequest.BodyPublisher ofByteArray(byte[] body)
      A body of bytes.
      Parameters:
      body - the bytes
      Returns:
      the publisher
    • ofByteArray

      public static HttpRequest.BodyPublisher ofByteArray(byte[] body, int offset, int length)
      Part of an array of bytes.
      Parameters:
      body - the bytes
      offset - where to start
      length - how many
      Returns:
      the publisher
    • noBody

      public static HttpRequest.BodyPublisher noBody()
      Returns a publisher that sends nothing.
      Returns:
      a publisher that sends nothing