org.apache.cocoon.mail.datasource
Class FilePartDataSource

java.lang.Object
  extended byorg.apache.cocoon.mail.datasource.FilePartDataSource
All Implemented Interfaces:
DataSource

public class FilePartDataSource
extends Object
implements DataSource

The FilePartDataSource class provides an object, that wraps a Cocoon Part object in a DataSource interface.

Version:
CVS $Id: FilePartDataSource.java 30941 2004-07-29 19:56:58Z vgritsenko $
Author:
Frank Ridderbusch, Christian Haul
See Also:
DataSource

Constructor Summary
FilePartDataSource(Part part)
          Creates a new instance of FilePartDataSource from an Part object.
FilePartDataSource(Part part, String type, String name)
          Creates a new instance of FilePartDataSource from an Part object.
 
Method Summary
 String getContentType()
          Return the content type (mime type) obtained from Part.getMimeType().
 InputStream getInputStream()
          The InputStream object obtained from Part.getInputStream() object.
 String getName()
          Returns the name for this DataSource object.
 OutputStream getOutputStream()
          Unimplemented.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilePartDataSource

public FilePartDataSource(Part part)
Creates a new instance of FilePartDataSource from an Part object.

Parameters:
part - An Part object.

FilePartDataSource

public FilePartDataSource(Part part,
                          String type,
                          String name)
Creates a new instance of FilePartDataSource from an Part object.

Parameters:
part - An Part object.
Method Detail

getContentType

public String getContentType()
Return the content type (mime type) obtained from Part.getMimeType(). Return application/octet-stream if getMimeType() returns null.

Specified by:
getContentType in interface DataSource
Returns:
The content type (mime type) for this DataSource object.

getInputStream

public InputStream getInputStream()
                           throws IOException
The InputStream object obtained from Part.getInputStream() object.

Specified by:
getInputStream in interface DataSource
Returns:
The InputStream object for this DataSource object.
Throws:
IOException - if an I/O error occurs.

getName

public String getName()
Returns the name for this DataSource object. This is what is returned by Part.getFileName().

Specified by:
getName in interface DataSource
Returns:
the name for this DataSource object.

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
Unimplemented. Directly throws IOException.

Specified by:
getOutputStream in interface DataSource
Returns:
nothing
Throws:
IOException - since unimplemented


Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.