|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.james.mime4j.field.AbstractField
public abstract class AbstractField
The base class of all field classes.
| Constructor Summary | |
|---|---|
protected |
AbstractField(java.lang.String name,
java.lang.String body,
ByteSequence raw)
|
| Method Summary | |
|---|---|
java.lang.String |
getBody()
Gets the unfolded, unparsed and possibly encoded (see RFC 2047) field body string. |
java.lang.String |
getName()
Gets the name of the field ( Subject,
From, etc). |
ParseException |
getParseException()
Returns the exception that was thrown by the field parser while parsing the field value. |
static DefaultFieldParser |
getParser()
Gets the default parser used to parse fields. |
ByteSequence |
getRaw()
Gets the original raw field string. |
boolean |
isValidField()
Returns true if this field is valid, i.e. |
static ParsedField |
parse(ByteSequence raw)
Parses the given byte sequence and returns an instance of the Field class. |
static ParsedField |
parse(java.lang.String rawStr)
Parses the given string and returns an instance of the Field class. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected AbstractField(java.lang.String name,
java.lang.String body,
ByteSequence raw)
| Method Detail |
|---|
public static ParsedField parse(ByteSequence raw)
throws MimeException
Field class. The type of the class returned depends on the
field name; see parse(String) for a table of field names and
their corresponding classes.
raw - the bytes to parse.
ParsedField instance.
MimeException - if the raw string cannot be split into field name and body.isValidField()
public static ParsedField parse(java.lang.String rawStr)
throws MimeException
Field class. The type of the class returned depends on
the field name:
| Class returned | Field names |
|---|---|
ContentTypeField | Content-Type |
ContentTransferEncodingField | Content-Transfer-Encoding |
ContentDispositionField | Content-Disposition |
DateTimeField | Date, Resent-Date |
MailboxField | Sender, Resent-Sender |
MailboxListField | From, Resent-From |
AddressListField | To, Cc, Bcc, Reply-To, Resent-To, Resent-Cc, Resent-Bcc |
UnstructuredField | Subject and others |
rawStr - the string to parse.
ParsedField instance.
MimeException - if the raw string cannot be split into field name and body.isValidField()public static DefaultFieldParser getParser()
public java.lang.String getName()
Subject,
From, etc).
getName in interface Fieldpublic ByteSequence getRaw()
getRaw in interface Fieldpublic java.lang.String getBody()
getBody in interface Fieldpublic boolean isValidField()
ParsedFieldtrue if this field is valid, i.e. no errors were
encountered while parsing the field value.
isValidField in interface ParsedFieldtrue if this field is valid, false
otherwise.ParsedField.isValidField()public ParseException getParseException()
ParsedFieldnull if the field is valid
and no errors were encountered.
getParseException in interface ParsedFieldnull if the field is valid.ParsedField.getParseException()public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||