Class MultipartStream

java.lang.Object
io.fusionauth.http.io.MultipartStream

public class MultipartStream extends Object
Handles the multipart body encoding and file uploads.
Author:
Brian Pontarelli
  • Constructor Details

    • MultipartStream

      public MultipartStream(InputStream input, byte[] boundary, int bufSize)
      Constructs a MultipartStream with a custom size buffer.

      Note that the buffer must be at least big enough to contain the boundary string, plus 4 characters for CR/LF and double dash, plus at least one byte of data. Too small a buffer size setting will degrade performance.

      Parameters:
      input - The InputStream to serve as a data source.
      boundary - The token used for dividing the stream into encapsulations.
      bufSize - The size of the buffer to be used, in bytes.
      Throws:
      IllegalArgumentException - If the buffer size is too small
  • Method Details

    • process

      public void process(Map<String,List<String>> parameters, List<FileInfo> files) throws IOException, ParseException
      Completely processes the multipart body and puts the parameters and files into the given collections.
      Parameters:
      parameters - The parameters.
      files - The files.
      Throws:
      IOException - If any I/O operation failed.
      ParseException - If the input is not a proper multipart body and could not be processed.