Package org.apache.james.mime4j.message
Interface BodyFactory
-
- All Known Implementing Classes:
BasicBodyFactory
,StorageBodyFactory
public interface BodyFactory
Factory for creating message bodies.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description BinaryBody
binaryBody(java.io.InputStream is)
Creates aBinaryBody
that holds the content of the given input stream.TextBody
textBody(java.io.InputStream is, java.lang.String mimeCharset)
Creates aTextBody
that holds the content of the given input stream.
-
-
-
Method Detail
-
binaryBody
BinaryBody binaryBody(java.io.InputStream is) throws java.io.IOException
Creates aBinaryBody
that holds the content of the given input stream.- Parameters:
is
- input stream to create a message body from.- Returns:
- a binary body.
- Throws:
java.io.IOException
- if an I/O error occurs.
-
textBody
TextBody textBody(java.io.InputStream is, java.lang.String mimeCharset) throws java.io.IOException
Creates aTextBody
that holds the content of the given input stream.The charset corresponding to the given MIME charset name is used to decode the byte content of the input stream into a character stream when calling
getReader()
on the returned object. If the MIME charset has no corresponding Java charset or the Java charset cannot be used for decoding then "us-ascii" is used instead.- Parameters:
is
- input stream to create a message body from.mimeCharset
- name of a MIME charset.- Returns:
- a text body.
- Throws:
java.io.IOException
- if an I/O error occurs.
-
-