Class BodyPartEntity

All Implemented Interfaces:
Closeable, AutoCloseable

public class BodyPartEntity extends Object implements Closeable
Proxy class representing the entity of a BodyPart when a MultiPart entity is received and parsed.

Its primary purpose is to provide an input stream to retrieve the actual data. However, it also transparently deals with storing the data in a temporary disk file, if it is larger than a configurable size; otherwise, the data is stored in memory for faster processing.

Craig McClanahan, Paul Sandoz, Michal Gajdos
  • Constructor Details

    • BodyPartEntity

      public BodyPartEntity(org.jvnet.mimepull.MIMEPart mimePart)
      Constructs a new BodyPartEntity with a MIMEPart.
      mimePart - MIMEPart containing the input stream of this body part entity.
  • Method Details

    • getInputStream

      public InputStream getInputStream()
      Gets the input stream of the raw bytes of this body part entity.
      the input stream of the body part entity.
    • cleanup

      public void cleanup()
      Cleans up temporary file(s), if any were utilized.
    • close

      public void close() throws IOException
      Defers to cleanup().
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • moveTo

      public void moveTo(File file)
      Move the contents of the underlying InputStream or File to the given file.
      file - destination file.