Class BodyPartEntity
- java.lang.Object
-
- org.glassfish.jersey.media.multipart.BodyPartEntity
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class BodyPartEntity extends Object implements Closeable
Proxy class representing the entity of aBodyPartwhen aMultiPartentity 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.- Author:
- Craig McClanahan, Paul Sandoz, Michal Gajdos
-
-
Constructor Summary
Constructors Constructor Description BodyPartEntity(org.jvnet.mimepull.MIMEPart mimePart)Constructs a newBodyPartEntitywith aMIMEPart.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanup()Cleans up temporary file(s), if any were utilized.voidclose()Defers tocleanup().InputStreamgetInputStream()Gets the input stream of the raw bytes of this body part entity.voidmoveTo(File file)Move the contents of the underlyingInputStreamorFileto the given file.
-
-
-
Method Detail
-
getInputStream
public InputStream getInputStream()
Gets the input stream of the raw bytes of this body part entity.- Returns:
- 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 IOExceptionDefers tocleanup().- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
moveTo
public void moveTo(File file)
Move the contents of the underlyingInputStreamorFileto the given file.- Parameters:
file- destination file.
-
-