public class ByteArraySource extends Object implements Source, Serializable
DEFAULT_CHARACTER_SET_ENCODING
Constructor and Description |
---|
ByteArraySource(byte[] bytes) |
ByteArraySource(byte[] bytes, int pos, int count) |
ByteArraySource(byte[] bytes, int pos, int count, String contentType) |
ByteArraySource(byte[] bytes, String contentType) |
Modifier and Type | Method and Description |
---|---|
byte[] |
getBytes()
Returns the underlying byte-array.
|
String |
getContentType() |
InputStream |
getInputStream(TransformOptions options)
Returns streaming byte-baseed representation of the Source's content.
|
int |
size() |
void |
writeTo(OutputStream out, TransformOptions options)
Serializes the Source's content to a byte-based stream.
|
public ByteArraySource(byte[] bytes)
public ByteArraySource(byte[] bytes, String contentType)
public ByteArraySource(byte[] bytes, int pos, int count)
public ByteArraySource(byte[] bytes, int pos, int count, String contentType)
public byte[] getBytes()
ByteArraySource
.public int size()
public InputStream getInputStream(TransformOptions options) throws IOException, TransformException
Source
getInputStream
in interface Source
options
- Options used to affect the serializationIOException
TransformException
public void writeTo(OutputStream out, TransformOptions options) throws IOException, TransformException
Source
Note that this method may involve an internal transformation, although it should not in any way change the underlying content.
writeTo
in interface Source
out
- the OutputStream to which serialized content will be writtenoptions
- TransformOptions used to affect the serializationIOException
TransformException
public String getContentType()