Class BodyPartEntity
- java.lang.Object
-
- org.glassfish.jersey.media.multipart.BodyPartEntity
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class BodyPartEntity extends java.lang.Object implements java.io.Closeable
Proxy class representing the entity of aBodyPart
when aMultiPart
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.
-
-
Constructor Summary
Constructors Constructor Description BodyPartEntity(org.jvnet.mimepull.MIMEPart mimePart)
Constructs a newBodyPartEntity
with aMIMEPart
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanup()
Cleans up temporary file(s), if any were utilized.void
close()
Defers tocleanup()
.java.io.InputStream
getInputStream()
Gets the input stream of the raw bytes of this body part entity.void
moveTo(java.io.File file)
Move the contents of the underlyingInputStream
orFile
to the given file.
-
-
-
Method Detail
-
getInputStream
public java.io.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 java.io.IOException
Defers tocleanup()
.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
moveTo
public void moveTo(java.io.File file)
Move the contents of the underlyingInputStream
orFile
to the given file.- Parameters:
file
- destination file.
-
-