public class ByteArrayDataSource
extends java.lang.Object
implements javax.activation.DataSource
String
or an
input stream.Constructor and Description |
---|
ByteArrayDataSource(byte[] data,
java.lang.String type)
Create a DataSource from a byte array.
|
ByteArrayDataSource(java.io.InputStream is,
java.lang.String type)
Create a DataSoruce from an input stream.
|
ByteArrayDataSource(java.lang.String data,
java.lang.String type)
Create a DataSource from a
String . |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getContentType()
Returns the content type for this data source.
|
java.io.InputStream |
getInputStream()
Returns an
InputStream for reading from this data source. |
java.lang.String |
getName()
Returns the name of the data source.
|
java.io.OutputStream |
getOutputStream()
This operation is not supported!
|
public ByteArrayDataSource(java.io.InputStream is, java.lang.String type)
is
- InputStream from which the data will be read.type
- Mime-Type of the data (e.g., "application/pdf").public ByteArrayDataSource(byte[] data, java.lang.String type)
data
- byte array holding the data for this data source. The byte array will
not be copied but used directly.type
- Mime-Type of the data (e.g., "application/pdf").public ByteArrayDataSource(java.lang.String data, java.lang.String type)
String
.data
- String holding the data for this data source.type
- Mime-Type of the data (e.g., "application/pdf").public java.io.InputStream getInputStream() throws java.io.IOException
InputStream
for reading from this data source.getInputStream
in interface javax.activation.DataSource
java.io.IOException
public java.io.OutputStream getOutputStream() throws java.io.IOException
IOException
will
be thrown.getOutputStream
in interface javax.activation.DataSource
java.io.IOException
public java.lang.String getContentType()
getContentType
in interface javax.activation.DataSource
public java.lang.String getName()
getName
in interface javax.activation.DataSource
@enterprise 9.0.33982 Copyright © 2001-2023 Groiss Informatics GmbH. All Rights Reserved.