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
ConstructorDescriptionBodyPartEntity
(org.jvnet.mimepull.MIMEPart mimePart) Constructs a newBodyPartEntity
with aMIMEPart
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
cleanup()
Cleans up temporary file(s), if any were utilized.void
close()
Defers tocleanup()
.Gets the input stream of the raw bytes of this body part entity.void
Move the contents of the underlyingInputStream
orFile
to the given file.
-
Constructor Details
-
BodyPartEntity
public BodyPartEntity(org.jvnet.mimepull.MIMEPart mimePart) Constructs a newBodyPartEntity
with 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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
moveTo
Move the contents of the underlyingInputStream
orFile
to the given file.- Parameters:
file
- destination file.
-