Class StreamingMultipartPartition

java.lang.Object
java.io.InputStream
com.renomad.minum.web.StreamingMultipartPartition
All Implemented Interfaces:
Closeable, AutoCloseable

public class StreamingMultipartPartition extends InputStream
This class represents a single partition in a multipart/form Request body, when read as an InputStream. This enables the developer to pull data incrementally, rather than reading it all into memory at once.
  • Method Details

    • getHeaders

      public Headers getHeaders()
    • getContentDisposition

      public ContentDisposition getContentDisposition()
    • read

      public int read() throws IOException
      Reads from the inputstream using a buffer for checking whether we've hit the end of a multpart partition.
      Specified by:
      read in class InputStream
      Returns:
      -1 if we're at the end of a partition
      Throws:
      IOException - if the inputstream is closed unexpectedly while reading.
    • readAllBytes

      public byte[] readAllBytes()
      Overrides:
      readAllBytes in class InputStream
    • close

      public void close() throws IOException
      By "close", we will read from the InputStream until we have finished the body, so that our InputStream has been read until the start of the next partition.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class InputStream
      Throws:
      IOException