org.apache.james.mime4j.message
Class BasicBodyFactory
java.lang.Object
org.apache.james.mime4j.message.BasicBodyFactory
- All Implemented Interfaces:
- BodyFactory
public class BasicBodyFactory
- extends java.lang.Object
- implements BodyFactory
Factory for creating message bodies.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BasicBodyFactory
public BasicBodyFactory()
binaryBody
public BinaryBody binaryBody(java.io.InputStream is)
throws java.io.IOException
- Description copied from interface:
BodyFactory
- Creates a
BinaryBody
that holds the content of the given input
stream.
- Specified by:
binaryBody
in interface BodyFactory
- 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
public TextBody textBody(java.io.InputStream is,
java.lang.String mimeCharset)
throws java.io.IOException
- Description copied from interface:
BodyFactory
- Creates a
TextBody
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.
- Specified by:
textBody
in interface BodyFactory
- 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.
textBody
public TextBody textBody(java.lang.String text,
java.lang.String mimeCharset)
throws java.io.UnsupportedEncodingException
- Throws:
java.io.UnsupportedEncodingException
textBody
public TextBody textBody(java.lang.String text,
java.nio.charset.Charset charset)
textBody
public TextBody textBody(java.lang.String text)
binaryBody
public BinaryBody binaryBody(byte[] buf)
Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.