org.apache.cocoon.mail.datasource
Class SourceDataSource

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

public class SourceDataSource
extends Object
implements DataSource

The SourceDataSource class provides an object, that wraps a Cocoon org.apache.excalibur.source.Source object in a DataSource interface.

Version:
CVS $Id: SourceDataSource.java 47609 2004-09-30 20:26:45Z vgritsenko $
Author:
Frank Ridderbusch, Christian Haul
See Also:
Source, DataSource

Constructor Summary
SourceDataSource(Source src)
          Creates a new instance of SourceDataSource
SourceDataSource(Source src, String type, String name)
          Creates a new instance of SourceDataSource
 
Method Summary
 String getContentType()
          Returns the result of a call to the Source objects getMimeType() method.
 InputStream getInputStream()
          Get the InputStream object from the Source 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

SourceDataSource

public SourceDataSource(Source src)
Creates a new instance of SourceDataSource

Parameters:
src - A org.apache.excalibur.source.Source Object.

SourceDataSource

public SourceDataSource(Source src,
                        String type,
                        String name)
Creates a new instance of SourceDataSource

Parameters:
src - A org.apache.excalibur.source.Source Object.
Method Detail

getContentType

public String getContentType()
Returns the result of a call to the Source objects getMimeType() method. Returns "application/octet-stream", if getMimeType() returns null.

Specified by:
getContentType in interface DataSource
Returns:
The content type (mime type) of this DataSource object.
See Also:
Source.getMimeType()

getInputStream

public InputStream getInputStream()
                           throws IOException
Get the InputStream object from the Source object.

Specified by:
getInputStream in interface DataSource
Returns:
The InputStream object from the Source object.
Throws:
IOException - if an I/O error occurs.
See Also:
Source.getInputStream()

getName

public String getName()
Returns the name for this DataSource object. This is actually the last path component (after the last '/') from the value returned by the getURI() method of the Source object.

Specified by:
getName in interface DataSource
Returns:
the name for this DataSource
See Also:
Source.getURI()

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.