Class AttachmentDataSource

java.lang.Object
com.day.cq.wcm.foundation.forms.attachments.AttachmentDataSource
All Implemented Interfaces:
FileDataSource, javax.activation.DataSource

public class AttachmentDataSource extends Object implements FileDataSource
Implementation of FileDataSource.
  • Constructor Details

    • AttachmentDataSource

      public AttachmentDataSource(RequestParameter fileRequestParameter)
      Constructor of AttachmentDataSource.
      Parameters:
      fileRequestParameter - The file request parameter
  • Method Details

    • getContentType

      public String getContentType()
      Specified by:
      getContentType in interface javax.activation.DataSource
      Returns:
      content media type.
    • getType

      public String getType()
      Description copied from interface: FileDataSource
      Returns the MIME type of the content.
      Specified by:
      getType in interface FileDataSource
      Returns:
      content MIME type.
    • getTypeFromFileName

      public String getTypeFromFileName()
      Description copied from interface: FileDataSource
      Returns the MIME type extension from file name.
      Specified by:
      getTypeFromFileName in interface FileDataSource
      Returns:
      content MIME type extension from file Name.
    • getSize

      public long getSize()
      Description copied from interface: FileDataSource
      Returns the size of the file in bytes.
      Specified by:
      getSize in interface FileDataSource
      Returns:
      size of attachment in bytes.
    • getInputStream

      public InputStream getInputStream() throws IOException
      Specified by:
      getInputStream in interface javax.activation.DataSource
      Returns:
      request parameter input stream.
      Throws:
      IOException - if I/O error occurs.
    • getName

      public String getName()
      Specified by:
      getName in interface javax.activation.DataSource
      Returns:
      request parameter file name.
    • getOutputStream

      public OutputStream getOutputStream() throws IOException
      Specified by:
      getOutputStream in interface javax.activation.DataSource
      Returns:
      request parameter output stream.
      Throws:
      IOException - if I/O error occurs.