Package org.opencms.util
Class CmsByteArrayDataSource
- java.lang.Object
-
- org.opencms.util.CmsByteArrayDataSource
-
- All Implemented Interfaces:
javax.activation.DataSource
public class CmsByteArrayDataSource extends java.lang.Object implements javax.activation.DataSource
A DataSource backed by a byte array. The byte array may be passed in directly, or may be initialized from an InputStream or a String.- Since:
- 6.3.0
-
-
Constructor Summary
Constructors Constructor Description CmsByteArrayDataSource(java.lang.String name, byte[] data, java.lang.String contentType)Creates a ByteArrayDataSource with data from the specified byte array and with the specified MIME type.
-
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()
-
-
-
Constructor Detail
-
CmsByteArrayDataSource
public CmsByteArrayDataSource(java.lang.String name, byte[] data, java.lang.String contentType)
Creates a ByteArrayDataSource with data from the specified byte array and with the specified MIME type.- Parameters:
name- the name of the datadata- the datacontentType- the MIME content type of the data
-
-
Method Detail
-
getContentType
public java.lang.String getContentType()
- Specified by:
getContentTypein interfacejavax.activation.DataSource- See Also:
DataSource.getContentType()
-
getInputStream
public java.io.InputStream getInputStream()
- Specified by:
getInputStreamin interfacejavax.activation.DataSource- See Also:
DataSource.getInputStream()
-
getName
public java.lang.String getName()
- Specified by:
getNamein interfacejavax.activation.DataSource- See Also:
DataSource.getName()
-
getOutputStream
public java.io.OutputStream getOutputStream() throws java.io.IOException
- Specified by:
getOutputStreamin interfacejavax.activation.DataSource- Throws:
java.io.IOException- See Also:
DataSource.getOutputStream()
-
-