Package org.apache.james.mime4j.message
Class BasicBodyFactory.StringBody3
- java.lang.Object
-
- org.apache.james.mime4j.dom.SingleBody
-
- org.apache.james.mime4j.dom.TextBody
-
- org.apache.james.mime4j.message.BasicBodyFactory.StringBody3
-
- All Implemented Interfaces:
Body,Disposable
- Enclosing class:
- BasicBodyFactory
static class BasicBodyFactory.StringBody3 extends TextBody
-
-
Field Summary
Fields Modifier and Type Field Description private java.nio.charset.Charsetcharsetprivate ByteArrayOutputStreamRecycler.Wrappercontent
-
Constructor Summary
Constructors Constructor Description StringBody3(ByteArrayOutputStreamRecycler.Wrapper content, java.nio.charset.Charset charset)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SingleBodycopy()Returns a copy of thisSingleBody(optional operation).voiddispose()Subclasses should override this method if they have allocated resources that need to be freed explicitly (e.g.java.nio.charset.CharsetgetCharset()java.io.InputStreamgetInputStream()Gets aInputStreamwhich reads the bytes of the body.java.lang.StringgetMimeCharset()Returns the MIME charset of this text body.java.io.ReadergetReader()Gets aReaderwhich may be used to read out the contents of this body.longsize()voidwriteTo(java.io.OutputStream out)Writes this single body to the given stream.-
Methods inherited from class org.apache.james.mime4j.dom.SingleBody
getParent, setParent
-
-
-
-
Field Detail
-
content
private final ByteArrayOutputStreamRecycler.Wrapper content
-
charset
private final java.nio.charset.Charset charset
-
-
Constructor Detail
-
StringBody3
StringBody3(ByteArrayOutputStreamRecycler.Wrapper content, java.nio.charset.Charset charset)
-
-
Method Detail
-
getMimeCharset
public java.lang.String getMimeCharset()
Description copied from class:TextBodyReturns the MIME charset of this text body.- Specified by:
getMimeCharsetin classTextBody- Returns:
- the MIME charset.
-
getCharset
public java.nio.charset.Charset getCharset()
- Specified by:
getCharsetin classTextBody
-
getReader
public java.io.Reader getReader() throws java.io.IOExceptionDescription copied from class:TextBodyGets aReaderwhich may be used to read out the contents of this body.
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOExceptionDescription copied from class:SingleBodyGets aInputStreamwhich reads the bytes of the body.- Specified by:
getInputStreamin classSingleBody- Returns:
- the stream, transfer decoded
- Throws:
java.io.IOException- on I/O errors.
-
size
public long size()
- Overrides:
sizein classSingleBody
-
writeTo
public void writeTo(java.io.OutputStream out) throws java.io.IOExceptionDescription copied from class:SingleBodyWrites this single body to the given stream. The default implementation copies the input stream obtained bySingleBody.getInputStream()to the specified output stream. May be overwritten by a subclass to improve performance.- Overrides:
writeToin classSingleBody- Parameters:
out- the stream to write to.- Throws:
java.io.IOException- in case of an I/O error
-
dispose
public void dispose()
Description copied from class:SingleBodySubclasses should override this method if they have allocated resources that need to be freed explicitly (e.g. cannot be simply reclaimed by the garbage collector). The default implementation of this method does nothing.- Specified by:
disposein interfaceDisposable- Overrides:
disposein classSingleBody- See Also:
Disposable.dispose()
-
copy
public SingleBody copy()
Description copied from class:SingleBodyReturns a copy of thisSingleBody(optional operation).The general contract of this method is as follows:
- Invoking
SingleBody.getParent()on the copy returnsnull. That means that the copy is detached from the parent entity of thisSingleBody. The copy may get attached to a different entity later on. - The underlying content does not have to be copied. Instead it may be
shared between multiple copies of a
SingleBody. - If the underlying content is shared by multiple copies the implementation has to make sure that the content gets deleted when the last copy gets disposed of (and not before that).
This implementation always throws an
UnsupportedOperationException.- Overrides:
copyin classSingleBody- Returns:
- a copy of this
SingleBody.
- Invoking
-
-