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.String
getContentType()
java.io.InputStream
getInputStream()
java.lang.String
getName()
java.io.OutputStream
getOutputStream()
long
getSize()
Returns the size of the file in bytes.java.lang.String
getType()
Returns the MIME type of the content.java.lang.String
getTypeFromFileName()
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:
getContentType
in interfacejavax.activation.DataSource
- Returns:
- content media type.
-
getType
public java.lang.String getType()
Description copied from interface:FileDataSource
Returns the MIME type of the content.- Specified by:
getType
in interfaceFileDataSource
- Returns:
- content MIME type.
-
getTypeFromFileName
public java.lang.String getTypeFromFileName()
Description copied from interface:FileDataSource
Returns the MIME type extension from file name.- Specified by:
getTypeFromFileName
in interfaceFileDataSource
- 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 interfaceFileDataSource
- Returns:
- size of attachment in bytes.
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOException
- Specified by:
getInputStream
in 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:
getName
in interfacejavax.activation.DataSource
- Returns:
- request parameter file name.
-
getOutputStream
public java.io.OutputStream getOutputStream() throws java.io.IOException
- Specified by:
getOutputStream
in interfacejavax.activation.DataSource
- Returns:
- request parameter output stream.
- Throws:
java.io.IOException
- if I/O error occurs.
-
-