|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.james.mime4j.message.AbstractEntity
public abstract class AbstractEntity
Abstract MIME entity.
| Constructor Summary | |
|---|---|
protected |
AbstractEntity()
Creates a new Entity. |
| Method Summary | |
|---|---|
protected abstract String |
calcCharset(ContentTypeField contentType)
|
protected abstract String |
calcMimeType(ContentTypeField child,
ContentTypeField parent)
|
protected abstract String |
calcTransferEncoding(ContentTransferEncodingField f)
|
void |
dispose()
Disposes of the body of this entity. |
Body |
getBody()
Gets the body of this entity. |
String |
getCharset()
Determines the MIME character set encoding of this Entity. |
String |
getContentTransferEncoding()
Determines the transfer encoding of this Entity. |
String |
getDispositionType()
Return the disposition type of the content disposition of this Entity. |
String |
getFilename()
Returns the filename parameter of the content disposition of this Entity. |
Header |
getHeader()
Gets the entity header. |
String |
getMimeType()
Determines the MIME type of this Entity. |
Entity |
getParent()
Gets the parent entity of this entity. |
boolean |
isMimeType(String type)
Determines if the MIME type of this Entity matches the
given one. |
boolean |
isMultipart()
Determines if the MIME type of this Entity is
multipart/*. |
protected abstract ContentDispositionField |
newContentDisposition(String dispositionType,
Map<String,String> parameters)
|
protected abstract ContentDispositionField |
newContentDisposition(String dispositionType,
String filename,
long size,
Date creationDate,
Date modificationDate,
Date readDate)
|
protected abstract ContentTransferEncodingField |
newContentTransferEncoding(String contentTransferEncoding)
|
protected abstract ContentTypeField |
newContentType(String mimeType,
Map<String,String> parameters)
|
protected abstract String |
newUniqueBoundary()
|
Body |
removeBody()
Removes and returns the body of this entity. |
void |
setBody(Body body)
Sets the body of this entity. |
void |
setBody(Body body,
String mimeType)
Sets the body of this entity and sets the content-type to the specified value. |
void |
setBody(Body body,
String mimeType,
Map<String,String> parameters)
Sets the body of this entity and sets the content-type to the specified value. |
void |
setContentDisposition(String dispositionType)
Sets the content disposition of this Entity to the
specified disposition type. |
void |
setContentDisposition(String dispositionType,
String filename)
Sets the content disposition of this Entity to the
specified disposition type and filename. |
void |
setContentDisposition(String dispositionType,
String filename,
long size)
Sets the content disposition of this Entity to the
specified values. |
void |
setContentDisposition(String dispositionType,
String filename,
long size,
Date creationDate,
Date modificationDate,
Date readDate)
Sets the content disposition of this Entity to the
specified values. |
void |
setContentTransferEncoding(String contentTransferEncoding)
Sets the transfer encoding of this Entity to the specified
value. |
void |
setFilename(String filename)
Sets the filename parameter of the content disposition of this Entity to the specified value. |
void |
setHeader(Header header)
Sets the entity header. |
void |
setMessage(Message message)
Sets the specified message as body of this entity and the content type to "message/rfc822". |
void |
setMultipart(Multipart multipart)
Sets the specified multipart as body of this entity. |
void |
setMultipart(Multipart multipart,
Map<String,String> parameters)
Sets the specified multipart as body of this entity. |
void |
setParent(Entity parent)
Sets the parent entity of this entity. |
void |
setText(TextBody textBody)
Sets the specified TextBody as body of this entity and the
content type to "text/plain". |
void |
setText(TextBody textBody,
String subtype)
Sets the specified TextBody as body of this entity. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected AbstractEntity()
Entity. Typically invoked implicitly by a
subclass constructor.
| Method Detail |
|---|
public Entity getParent()
null if this is the root entity.
getParent in interface Entitynull.public void setParent(Entity parent)
setParent in interface Entityparent - the parent entity or null if
this will be the root entity.public Header getHeader()
getHeader in interface Entitypublic void setHeader(Header header)
setHeader in interface Entityheader - the header.public Body getBody()
getBody in interface Entitypublic void setBody(Body body)
setBody in interface Entitybody - the body.
IllegalStateException - if the body has already been set.public Body removeBody()
disposed of.
removeBody in interface Entitynull if no body was set.public void setMessage(Message message)
Header is created if this
entity does not already have one.
message - the message to set as body.public void setMultipart(Multipart multipart)
Header is created if this entity does not already have
one.
multipart - the multipart to set as body.
public void setMultipart(Multipart multipart,
Map<String,String> parameters)
Header is created if this entity does not already have
one.
multipart - the multipart to set as body.parameters - additional parameters for the Content-Type header field.public void setText(TextBody textBody)
TextBody as body of this entity and the
content type to "text/plain". A Header is
created if this entity does not already have one.
textBody - the TextBody to set as body.BodyFactory.textBody(java.io.InputStream, String)
public void setText(TextBody textBody,
String subtype)
TextBody as body of this entity. Also
sets the content type according to the specified sub-type. A
Header is created if this entity does not already have
one.
textBody - the TextBody to set as body.subtype - the text subtype (e.g. "plain", "html" or
"xml").
public void setBody(Body body,
String mimeType)
Header is created if this entity does not already
have one.
body - the body.mimeType - the MIME media type of the specified body
("type/subtype").
public void setBody(Body body,
String mimeType,
Map<String,String> parameters)
Header is created if this entity does not already
have one.
body - the body.mimeType - the MIME media type of the specified body
("type/subtype").parameters - additional parameters for the Content-Type header field.public String getMimeType()
Entity. The MIME type
is derived by looking at the parent's Content-Type field if no
Content-Type field is set for this Entity.
getMimeType in interface Entitypublic String getCharset()
Entity.
getCharset in interface Entitypublic String getContentTransferEncoding()
Entity.
getContentTransferEncoding in interface Entitypublic void setContentTransferEncoding(String contentTransferEncoding)
Entity to the specified
value.
contentTransferEncoding - transfer encoding to use.public String getDispositionType()
Entity.
getDispositionType in interface Entitynull if no disposition
type has been set.public void setContentDisposition(String dispositionType)
Entity to the
specified disposition type. No filename, size or date parameters
are included in the content disposition.
dispositionType - disposition type value (usually inline or
attachment).
public void setContentDisposition(String dispositionType,
String filename)
Entity to the
specified disposition type and filename. No size or date parameters are
included in the content disposition.
dispositionType - disposition type value (usually inline or
attachment).filename - filename parameter value or null if the
parameter should not be included.
public void setContentDisposition(String dispositionType,
String filename,
long size)
Entity to the
specified values. No date parameters are included in the content
disposition.
dispositionType - disposition type value (usually inline or
attachment).filename - filename parameter value or null if the
parameter should not be included.size - size parameter value or -1 if the parameter
should not be included.
public void setContentDisposition(String dispositionType,
String filename,
long size,
Date creationDate,
Date modificationDate,
Date readDate)
Entity to the
specified values.
dispositionType - disposition type value (usually inline or
attachment).filename - filename parameter value or null if the
parameter should not be included.size - size parameter value or -1 if the parameter
should not be included.creationDate - creation-date parameter value or null if the
parameter should not be included.modificationDate - modification-date parameter value or null if
the parameter should not be included.readDate - read-date parameter value or null if the
parameter should not be included.public String getFilename()
Entity.
getFilename in interface Entitynull if the filename has not been set.public void setFilename(String filename)
Entity to the specified value. If this entity does not
have a content disposition header field a new one with disposition type
attachment is created.
filename - filename parameter value or null if the
parameter should be removed.public boolean isMimeType(String type)
Entity matches the
given one. MIME types are case-insensitive.
type - the MIME type to match against.
true on match, false otherwise.public boolean isMultipart()
Entity is
multipart/*. Since multipart-entities must have
a boundary parameter in the Content-Type field this
method returns false if no boundary exists.
isMultipart in interface Entitytrue on match, false otherwise.public void dispose()
dispose in interface DisposableDisposable.dispose()protected abstract String newUniqueBoundary()
protected abstract ContentDispositionField newContentDisposition(String dispositionType,
String filename,
long size,
Date creationDate,
Date modificationDate,
Date readDate)
protected abstract ContentDispositionField newContentDisposition(String dispositionType,
Map<String,String> parameters)
protected abstract ContentTypeField newContentType(String mimeType,
Map<String,String> parameters)
protected abstract ContentTransferEncodingField newContentTransferEncoding(String contentTransferEncoding)
protected abstract String calcMimeType(ContentTypeField child,
ContentTypeField parent)
protected abstract String calcTransferEncoding(ContentTransferEncodingField f)
protected abstract String calcCharset(ContentTypeField contentType)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||