Class BodyPartEntity
java.lang.Object
org.glassfish.jersey.media.multipart.BodyPartEntity
- All Implemented Interfaces:
Closeable,AutoCloseable
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.- Author:
- Craig McClanahan, Paul Sandoz, Michal Gajdos
-
Constructor Summary
ConstructorsConstructorDescriptionBodyPartEntity(org.jvnet.mimepull.MIMEPart mimePart) Constructs a newBodyPartEntitywith aMIMEPart. -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanup()Cleans up temporary file(s), if any were utilized.voidclose()Defers tocleanup().Gets the input stream of the raw bytes of this body part entity.voidMove the contents of the underlyingInputStreamorFileto the given file.
-
Constructor Details
-
BodyPartEntity
public BodyPartEntity(org.jvnet.mimepull.MIMEPart mimePart) Constructs a newBodyPartEntitywith aMIMEPart.- Parameters:
mimePart- MIMEPart containing the input stream of this body part entity.
-
-
Method Details
-
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
Defers tocleanup().- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
moveTo
Move the contents of the underlyingInputStreamorFileto the given file.- Parameters:
file- destination file.
-