Class MultiPartFormContent


  • public class MultiPartFormContent
    extends HttpContent
    • Constructor Detail

      • MultiPartFormContent

        public MultiPartFormContent()
      • MultiPartFormContent

        public MultiPartFormContent​(java.lang.String boundary)
    • Method Detail

      • addPart

        public MultiPartFormContent addPart​(java.lang.String name,
                                            HttpContent content,
                                            @Nullable
                                            java.lang.String fileName)
        Add a new part to the form data.
        Parameters:
        name - The name of the part
        content - The content of the part
        fileName - The file name of the part
        Returns:
        This instance for chaining
      • canBeStreamedMultipleTimes

        public boolean canBeStreamedMultipleTimes()
        Description copied from class: HttpContent
        Get if the content can be streamed multiple times.
        The return value is allowed to change between multiple calls depending on the implementation.
        Specified by:
        canBeStreamedMultipleTimes in class HttpContent
        Returns:
        If the content can be streamed multiple times
      • getLength

        public int getLength()
        Description copied from class: HttpContent
        Get the content length in bytes.
        If the content length is unknown, return -1.
        Streaming the content may require valid content length depending on the implementation.
        Specified by:
        getLength in class HttpContent
        Returns:
        The content length
      • compute

        @Nonnull
        protected java.io.InputStream compute()
                                       throws java.io.IOException
        Description copied from class: HttpContent
        Compute the content and return it as an input stream.
        This method can be called multiple times if HttpContent.canBeStreamedMultipleTimes() returns true.
        Specified by:
        compute in class HttpContent
        Returns:
        The content
        Throws:
        java.io.IOException - If an I/O error occurs