Class AttachmentDataSource
- java.lang.Object
-
- com.day.cq.wcm.foundation.forms.attachments.AttachmentDataSource
-
- All Implemented Interfaces:
FileDataSource,javax.activation.DataSource
public class AttachmentDataSource extends java.lang.Object implements FileDataSource
Implementation ofFileDataSource.
-
-
Constructor Summary
Constructors Constructor Description AttachmentDataSource(RequestParameter fileRequestParameter)Constructor ofAttachmentDataSource.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetContentType()java.io.InputStreamgetInputStream()java.lang.StringgetName()java.io.OutputStreamgetOutputStream()longgetSize()Returns the size of the file in bytes.java.lang.StringgetType()Returns the MIME type of the content.java.lang.StringgetTypeFromFileName()Returns the MIME type extension from file name.
-
-
-
Constructor Detail
-
AttachmentDataSource
public AttachmentDataSource(RequestParameter fileRequestParameter)
Constructor ofAttachmentDataSource.- Parameters:
fileRequestParameter- The file request parameter
-
-
Method Detail
-
getContentType
public java.lang.String getContentType()
- Specified by:
getContentTypein interfacejavax.activation.DataSource- Returns:
- content media type.
-
getType
public java.lang.String getType()
Description copied from interface:FileDataSourceReturns the MIME type of the content.- Specified by:
getTypein interfaceFileDataSource- Returns:
- content MIME type.
-
getTypeFromFileName
public java.lang.String getTypeFromFileName()
Description copied from interface:FileDataSourceReturns the MIME type extension from file name.- Specified by:
getTypeFromFileNamein interfaceFileDataSource- Returns:
- content MIME type extension from file Name.
-
getSize
public long getSize()
Description copied from interface:FileDataSourceReturns the size of the file in bytes.- Specified by:
getSizein interfaceFileDataSource- Returns:
- size of attachment in bytes.
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOException- Specified by:
getInputStreamin interfacejavax.activation.DataSource- Returns:
- request parameter input stream.
- Throws:
java.io.IOException- if I/O error occurs.
-
getName
public java.lang.String getName()
- Specified by:
getNamein interfacejavax.activation.DataSource- Returns:
- request parameter file name.
-
getOutputStream
public java.io.OutputStream getOutputStream() throws java.io.IOException- Specified by:
getOutputStreamin interfacejavax.activation.DataSource- Returns:
- request parameter output stream.
- Throws:
java.io.IOException- if I/O error occurs.
-
-