public abstract class SingleBody extends Object implements Body
Modifier | Constructor and Description |
---|---|
protected |
SingleBody()
Sole constructor.
|
Modifier and Type | Method and Description |
---|---|
SingleBody |
copy()
Returns a copy of this
SingleBody (optional operation). |
void |
dispose()
Subclasses should override this method if they have allocated resources
that need to be freed explicitly (e.g.
|
abstract InputStream |
getInputStream()
Gets a
InputStream which reads the bytes of the body. |
Entity |
getParent()
Gets the parent of this body.
|
void |
setParent(Entity parent)
Sets the parent of this body.
|
void |
writeTo(OutputStream out)
Writes this single body to the given stream.
|
public Entity getParent()
Body
getParent
in interface Body
Body.getParent()
public void setParent(Entity parent)
Body
setParent
in interface Body
parent
- the parent.Body.setParent(org.apache.james.mime4j.dom.Entity)
public abstract InputStream getInputStream() throws IOException
InputStream
which reads the bytes of the body.IOException
- on I/O errors.public void writeTo(OutputStream out) throws IOException
getInputStream()
to the specified output
stream. May be overwritten by a subclass to improve performance.out
- the stream to write to.IOException
- in case of an I/O errorpublic SingleBody copy()
SingleBody
(optional operation).
The general contract of this method is as follows:
getParent()
on the copy returns null
.
That means that the copy is detached from the parent entity of this
SingleBody
. The copy may get attached to a different
entity later on.SingleBody
.
This implementation always throws an
UnsupportedOperationException
.
SingleBody
.UnsupportedOperationException
- if the copy
operation is not supported by this
single body.public void dispose()
dispose
in interface Disposable
Disposable.dispose()
Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.