|
Java EE 5 SDK | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.mail.util.ByteArrayDataSource
public class ByteArrayDataSource
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.
Constructor Summary | |
---|---|
ByteArrayDataSource(byte[] data,
String type)
Create a ByteArrayDataSource with data from the specified byte array and with the specified MIME type. |
|
ByteArrayDataSource(InputStream is,
String type)
Create a ByteArrayDataSource with data from the specified InputStream and with the specified MIME type. |
|
ByteArrayDataSource(String data,
String type)
Create a ByteArrayDataSource with data from the specified String and with the specified MIME type. |
Method Summary | |
---|---|
String |
getContentType()
Get the MIME content type of the data. |
InputStream |
getInputStream()
Return an InputStream for the data. |
String |
getName()
Get the name of the data. |
OutputStream |
getOutputStream()
Return an OutputStream for the data. |
void |
setName(String name)
Set the name of the data. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ByteArrayDataSource(InputStream is, String type) throws IOException
is
- the InputStreamtype
- the MIME type
IOException
- errors reading the streampublic ByteArrayDataSource(byte[] data, String type)
data
- the datatype
- the MIME typepublic ByteArrayDataSource(String data, String type) throws IOException
charset
parameter specifying the charset to be used for the
string. If the parameter is not included, the
default charset is used.
data
- the Stringtype
- the MIME type
IOException
- errors reading the StringMethod Detail |
---|
public InputStream getInputStream() throws IOException
getInputStream
in interface DataSource
IOException
- if no data has been setpublic OutputStream getOutputStream() throws IOException
IOException
is always thrown.
getOutputStream
in interface DataSource
IOException
- alwayspublic String getContentType()
getContentType
in interface DataSource
public String getName()
getName
in interface DataSource
public void setName(String name)
name
- the name of this data
|
Java EE 5 SDK | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 2006 Sun Microsystems, Inc. All rights reserved.