Class MultipartProcessor


  • public class MultipartProcessor
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      MultipartProcessor​(java.io.OutputStream outputStream, java.lang.String boundary, java.nio.charset.Charset charset)
      Constructs a new multipart body builder.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addFileField​(java.lang.String name, java.lang.String fileName, java.io.InputStream inputStream)
      Adds a file field to the multipart message, but takes in an InputStream instead of just a file to read bytes from.
      void addFormField​(java.lang.String name, java.lang.String value)
      Adds a form field to the multipart message.
      void finish()
      Adds the final boundary to the multipart message and closes streams.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MultipartProcessor

        public MultipartProcessor​(java.io.OutputStream outputStream,
                                  java.lang.String boundary,
                                  java.nio.charset.Charset charset)
                           throws java.io.IOException
        Constructs a new multipart body builder.
        Throws:
        java.io.IOException
    • Method Detail

      • addFormField

        public void addFormField​(java.lang.String name,
                                 java.lang.String value)
        Adds a form field to the multipart message.
        Parameters:
        name - field name
        value - field value
      • addFileField

        public void addFileField​(java.lang.String name,
                                 java.lang.String fileName,
                                 java.io.InputStream inputStream)
                          throws java.io.IOException
        Adds a file field to the multipart message, but takes in an InputStream instead of just a file to read bytes from.
        Parameters:
        name - Field name
        fileName - Name of the "file" being uploaded.
        inputStream - Stream of bytes to use in place of a file.
        Throws:
        java.io.IOException - Thrown when writing / reading from streams fails.
      • finish

        public void finish()
                    throws java.io.IOException
        Adds the final boundary to the multipart message and closes streams.
        Throws:
        java.io.IOException