org.apache.james.mime4j.message.storage
Interface TempFile


public interface TempFile

Version:
$Id: TempFile.java,v 1.3 2004/10/02 12:41:11 ntherning Exp $

Method Summary
 void delete()
          Deletes this file as soon as possible.
 java.lang.String getAbsolutePath()
          Returns the absolute path including file name of this TempFile.
 java.io.InputStream getInputStream()
          Gets an InputStream to read bytes from this temporary file.
 java.io.OutputStream getOutputStream()
          Gets an OutputStream to write bytes to this temporary file.
 boolean isInMemory()
          Determines if this is an in-memory file.
 long length()
          Gets the length of this temporary file.
 

Method Detail

getInputStream

java.io.InputStream getInputStream()
                                   throws java.io.IOException
Gets an InputStream to read bytes from this temporary file. NOTE: The stream should NOT be wrapped in BufferedInputStream by the caller. If the implementing TempFile creates a FileInputStream or any other stream which would benefit from being buffered it's the TempFile's responsibility to wrap it.

Returns:
the stream.
Throws:
java.io.IOException

getOutputStream

java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Gets an OutputStream to write bytes to this temporary file. NOTE: The stream should NOT be wrapped in BufferedOutputStream by the caller. If the implementing TempFile creates a FileOutputStream or any other stream which would benefit from being buffered it's the TempFile's responsibility to wrap it.

Returns:
the stream.
Throws:
java.io.IOException

getAbsolutePath

java.lang.String getAbsolutePath()
Returns the absolute path including file name of this TempFile. The path may be null if this is an in-memory file.

Returns:
the absolute path.

delete

void delete()
Deletes this file as soon as possible.


isInMemory

boolean isInMemory()
Determines if this is an in-memory file.

Returns:
true if this file is currently in memory, false otherwise.

length

long length()
Gets the length of this temporary file.

Returns:
the length.


Copyright © 2004-2008 The Apache Software Foundation. All Rights Reserved.