类 Bodies


  • public class Bodies
    extends Object
    Utils method to create body
    • 构造器详细资料

      • Bodies

        public Bodies()
    • 方法详细资料

      • plainText

        public static Body<String> plainText​(String value,
                                             Charset charset)
        Create request body sending plain text.
      • octetStream

        public static Body<byte[]> octetStream​(byte[] value)
        Create octet-stream request body.
      • octetStream

        public static Body<Path> octetStream​(Path path)
        Create octet-stream request body.
      • plainText

        public static Body<String> plainText​(String value)
        Create request body sending plain text, with UTF-8 charset.
      • wwwForm

        public static Body<List<Param>> wwwForm​(Collection<? extends Param> params)
        Create request body send x-www-form-encoded data, with UTF-8 charset.
      • wwwForm

        public static Body<List<Param>> wwwForm​(Map<String,​String> params)
        Create request body send x-www-form-encoded data, with UTF-8 charset.
      • wwwForm

        public static Body<List<Param>> wwwForm​(Param... params)
        Create request body send x-www-form-encoded data, with UTF-8 charset.
      • multiPart

        public static Body<List<Part<?>>> multiPart​(List<? extends Part<?>> parts)
        Create multi-part encoded request body, from several Parts.
      • multiPart

        public static Body<List<Part<?>>> multiPart​(Part<?>... parts)
        Create multi-part encoded request body, from several Parts.
      • json

        public static <@Nullable T> Body<T> json​(@Nullable T value,
                                                 Charset charset,
                                                 JsonMarshaller jsonMarshaller)
        Create a json body
        类型参数:
        T - the value type
        参数:
        value - the value to marshall to json
      • json

        public static <@Nullable T> Body<T> json​(@Nullable T value,
                                                 JsonMarshaller jsonMarshaller)
        Create a json body, with charset utf-8.
        类型参数:
        T - the value type
        参数:
        value - the value to marshall to json
      • of

        public static Body<byte[]> of​(byte[] value,
                                      MimeType mimeType)
        Create request body from byte array data
        参数:
        mimeType - the mime-type of body
      • of

        public static Body<byte[]> of​(byte[] value,
                                      MimeType mimeType,
                                      Charset charset)
        Create request body from byte array data
        参数:
        mimeType - the mime-type of body
        charset - the charset encoding of body
      • of

        public static Body<String> of​(String value,
                                      MimeType mimeType)
        Create request body send string data using UTF-8 charset.
        参数:
        mimeType - the mime-type of body
      • of

        public static Body<String> of​(String value,
                                      MimeType mimeType,
                                      Charset charset)
        Create request body send string data
        参数:
        mimeType - the mime-type of body
        charset - the charset encoding of body
      • of

        public static Body<InputSupplier> of​(InputSupplier supplier,
                                             MimeType mimeType,
                                             Charset charset)
        Create request body from input stream.
        参数:
        mimeType - the mime-type of body
        charset - the charset encoding of body
      • of

        public static Body<Path> of​(Path path,
                                    MimeType mimeType)
        Create request body from file
        参数:
        mimeType - the mime-type of body
      • of

        public static Body<Path> of​(Path path,
                                    MimeType mimeType,
                                    Charset charset)
        Create request body from file
        参数:
        mimeType - the mime-type of body
        charset - the charset encoding of body