com.sun.jersey.multipart
Class BodyPartEntity

java.lang.Object
  extended by com.sun.jersey.multipart.BodyPartEntity

public class BodyPartEntity
extends java.lang.Object

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.


Constructor Summary
BodyPartEntity(java.io.InputStream stream)
          Construct a new BodyPartEntity with a default threshold size.
BodyPartEntity(java.io.InputStream stream, int threshold)
          Construct a new BodyPartEntity with a specified threshold size.
 
Method Summary
 void cleanup()
          Clean up the temporary file we used, if any.
 java.io.InputStream getInputStream()
          Return an input stream to the raw bytes of this body part entity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BodyPartEntity

public BodyPartEntity(java.io.InputStream stream)
               throws java.io.IOException

Construct a new BodyPartEntity with a default threshold size.

Parameters:
stream - InputStream containing the raw bytes of this body part
Throws:
java.io.IOException - if an input/output error occurs

BodyPartEntity

public BodyPartEntity(java.io.InputStream stream,
                      int threshold)
               throws java.io.IOException

Construct a new BodyPartEntity with a specified threshold size.

Parameters:
stream - InputStream containing the raw bytes of this body part
threshold - Desired threshold size
Throws:
java.lang.IllegalArgumentException - if the specified threshold is not positive
java.io.IOException - if an input/output error occurs
Method Detail

cleanup

public void cleanup()

Clean up the temporary file we used, if any.


getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException

Return an input stream to the raw bytes of this body part entity.

Throws:
java.io.IOException


Copyright © 2009 Sun Microsystems, Inc. All Rights Reserved.