FileDocCategorySizeDatePackage
TempFileBinaryBody.javaAPI DocAndroid 1.5 API3341Wed May 06 22:42:46 BST 2009org.apache.james.mime4j.message

TempFileBinaryBody

public class TempFileBinaryBody extends AbstractBody implements BinaryBody
Binary body backed by a {@link org.apache.james.mime4j.util.TempFile}.
version
$Id: TempFileBinaryBody.java,v 1.2 2004/10/02 12:41:11 ntherning Exp $

Fields Summary
private static Log
log
private Entity
parent
private org.apache.james.mime4j.util.TempFile
tempFile
Constructors Summary
public TempFileBinaryBody(InputStream is)
Use the given InputStream to build the TemporyFileBinaryBody

param
is the InputStream to use as source
throws
IOException


                            
         
        
        TempPath tempPath = TempStorage.getInstance().getRootTempPath();
        tempFile = tempPath.createTempFile("attachment", ".bin");
        
        OutputStream out = tempFile.getOutputStream();
        IOUtils.copy(is, out);
        out.close();
    
Methods Summary
public java.io.InputStreamgetInputStream()

see
org.apache.james.mime4j.message.BinaryBody#getInputStream()

        return tempFile.getInputStream();
    
public EntitygetParent()

see
org.apache.james.mime4j.message.AbstractBody#getParent()

        return parent;
    
public voidsetParent(Entity parent)

see
org.apache.james.mime4j.message.AbstractBody#setParent(org.apache.james.mime4j.message.Entity)

        this.parent = parent;
    
public voidwriteTo(java.io.OutputStream out)

see
org.apache.james.mime4j.message.Body#writeTo(java.io.OutputStream)

	IOUtils.copy(getInputStream(),out);