public class MimeSource extends Object implements Source, Serializable
The serialization format for this Source is a fully-compliant MIME package. This source is also cognizant of Content-Transfer-Encoding, and it will perform the proper encoding of the underlying content stream if the header is present. Note that this means that the Source provided to the constructor should be in raw form and should not be already encoded.
Modifier and Type | Field and Description |
---|---|
static String |
EXCLUDE_HEADERS
transform option that tells the source not to include the MIME multipart headers when returning source content as a stream
|
DEFAULT_CHARACTER_SET_ENCODING
Constructor and Description |
---|
MimeSource(Headers headers, Source content) |
Modifier and Type | Method and Description |
---|---|
void |
addRef() |
void |
dispose() |
Source |
getContent() |
String |
getContentType() |
Headers |
getHeaders() |
InputStream |
getInputStream(TransformOptions options)
Returns streaming byte-baseed representation of the Source's content.
|
void |
writeTo(OutputStream out, TransformOptions options)
Serializes the Source's content to a byte-based stream.
|
public static final String EXCLUDE_HEADERS
public MimeSource(Headers headers, Source content)
public Headers getHeaders()
public Source getContent()
public String getContentType()
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 void addRef()
public void dispose() throws IOException
IOException