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

MemoryBinaryBody

public class MemoryBinaryBody 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 byte[]
tempFile
Constructors Summary
public MemoryBinaryBody(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();
        
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        IOUtils.copy(is, out);
        out.close();
        tempFile = out.toByteArray();
    
Methods Summary
public java.io.InputStreamgetInputStream()

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

        return new ByteArrayInputStream(tempFile);
    
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);