Package org.apache.james.mime4j.message
Class BasicBodyFactory.BinaryBody3
java.lang.Object
org.apache.james.mime4j.dom.SingleBody
org.apache.james.mime4j.dom.BinaryBody
org.apache.james.mime4j.message.BasicBodyFactory.BinaryBody3
- All Implemented Interfaces:
Body
,Disposable
- Enclosing class:
BasicBodyFactory
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()
Returns a copy of thisSingleBody
(optional operation).void
dispose()
Subclasses should override this method if they have allocated resources that need to be freed explicitly (e.g.Gets aInputStream
which reads the bytes of the body.long
size()
void
writeTo
(OutputStream out) Writes this single body to the given stream.Methods inherited from class org.apache.james.mime4j.dom.SingleBody
getParent, setParent
-
Field Details
-
-
Constructor Details
-
BinaryBody3
BinaryBody3(ByteArrayOutputStreamRecycler.Wrapper content)
-
-
Method Details
-
getInputStream
Description copied from class:SingleBody
Gets aInputStream
which reads the bytes of the body.- Specified by:
getInputStream
in classSingleBody
- Returns:
- the stream, transfer decoded
- Throws:
IOException
- on I/O errors.
-
writeTo
Description copied from class:SingleBody
Writes 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:
writeTo
in classSingleBody
- Parameters:
out
- the stream to write to.- Throws:
IOException
- in case of an I/O error
-
size
public long size()- Overrides:
size
in classSingleBody
-
dispose
public void dispose()Description copied from class:SingleBody
Subclasses 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:
dispose
in interfaceDisposable
- Overrides:
dispose
in classSingleBody
- See Also:
-
copy
Description copied from class:SingleBody
Returns 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:
copy
in classSingleBody
- Returns:
- a copy of this
SingleBody
.
- Invoking
-