public class ByteArrayDataSource extends Object implements DataSource, Serializable
| Constructor and Description |
|---|
ByteArrayDataSource(byte[] content,
String contentType)
Create a ByteArrayDataSource using the provided byte content and
contentType.
|
ByteArrayDataSource(InputStream stream,
String contentType)
Create a ByteArrayDataSource using the provided InputStream and
contentType.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getBytes()
Get the content of this DataSource as a byte array.
|
String |
getContentType() |
InputStream |
getInputStream() |
String |
getName() |
OutputStream |
getOutputStream()
Get an OutputStream for this DataSource.
|
void |
setName(String name) |
void |
writeTo(OutputStream os) |
public ByteArrayDataSource(InputStream stream, String contentType) throws IOException
stream - contentType - IOExceptionpublic ByteArrayDataSource(byte[] content,
String contentType)
content - contentType - public String getContentType()
getContentType in interface DataSourcepublic InputStream getInputStream() throws IOException
getInputStream in interface DataSourceIOExceptionpublic String getName()
getName in interface DataSourcepublic void setName(String name)
public OutputStream getOutputStream() throws IOException
getOutputStream in interface DataSourceIOExceptionpublic void writeTo(OutputStream os) throws IOException
IOExceptionpublic byte[] getBytes()
Copyright © 2009,2014 Oracle and/or its affiliates. All rights reserved.