Class CmsVfsDataSource

java.lang.Object
org.opencms.mail.CmsVfsDataSource
All Implemented Interfaces:
javax.activation.DataSource

public class CmsVfsDataSource extends Object implements javax.activation.DataSource
DataSource wrapper for VFS resources, allows easy sending of VFS resources as email attachments.

Since:
6.2.0
  • Constructor Details

    • 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 context
      resource - the resource to use
      Throws:
      CmsException - in case of errors accessing the resource in the VFS
  • Method Details

    • getContentType

      Specified by:
      getContentType in interface javax.activation.DataSource
      See Also:
      • DataSource.getContentType()
    • getInputStream

      Returns an input stream baded on the file contents.

      Specified by:
      getInputStream in interface javax.activation.DataSource
      See Also:
      • DataSource.getInputStream()
    • getName

      public String getName()
      Returns the root path of the given resource.

      Specified by:
      getName in interface javax.activation.DataSource
      See Also:
      • DataSource.getName()
    • 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 interface javax.activation.DataSource
      See Also:
      • DataSource.getOutputStream()