Package org.opencms.mail
Class CmsVfsDataSource
- java.lang.Object
-
- org.opencms.mail.CmsVfsDataSource
-
- All Implemented Interfaces:
javax.activation.DataSource
public class CmsVfsDataSource extends java.lang.Object implements javax.activation.DataSource
DataSource wrapper for VFS resources, allows easy sending of VFS resources as email attachments.- Since:
- 6.2.0
-
-
Constructor Summary
Constructors Constructor Description CmsVfsDataSource(CmsObject cms, CmsResource resource)
Creates a new data source for the given VFS resource.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getContentType()
java.io.InputStream
getInputStream()
Returns an input stream baded on the file contents.java.lang.String
getName()
Returns the root path of the given resource.java.io.OutputStream
getOutputStream()
Don't use this method, VFS resources can't be written using this datasource class.
-
-
-
Constructor Detail
-
CmsVfsDataSource
public CmsVfsDataSource(CmsObject cms, CmsResource resource) throws CmsException
Creates a new data source for the given VFS resource.- Parameters:
cms
- the current users OpenCms contextresource
- the resource to use- Throws:
CmsException
- in case of errors accessing the resource in the VFS
-
-
Method Detail
-
getContentType
public java.lang.String getContentType()
- Specified by:
getContentType
in interfacejavax.activation.DataSource
- See Also:
DataSource.getContentType()
-
getInputStream
public java.io.InputStream getInputStream()
Returns an input stream baded on the file contents.- Specified by:
getInputStream
in interfacejavax.activation.DataSource
- See Also:
DataSource.getInputStream()
-
getName
public java.lang.String getName()
Returns the root path of the given resource.- Specified by:
getName
in interfacejavax.activation.DataSource
- See Also:
DataSource.getName()
-
getOutputStream
public java.io.OutputStream getOutputStream()
Don't use this method, VFS resources can't be written using this datasource class.This method will just return a new
.ByteArrayOutputStream
- Specified by:
getOutputStream
in interfacejavax.activation.DataSource
- See Also:
DataSource.getOutputStream()
-
-