public abstract class AbstractField extends java.lang.Object implements ParsedField
Modifier | Constructor and Description |
---|---|
protected |
AbstractField(java.lang.String name,
java.lang.String body,
ByteSequence raw) |
Modifier and Type | Method and Description |
---|---|
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() |
protected AbstractField(java.lang.String name, java.lang.String body, ByteSequence raw)
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).public ByteSequence getRaw()
public java.lang.String getBody()
public boolean isValidField()
ParsedField
true
if this field is valid, i.e. no errors were
encountered while parsing the field value.isValidField
in interface ParsedField
true
if this field is valid, false
otherwise.ParsedField.isValidField()
public ParseException getParseException()
ParsedField
null
if the field is valid
and no errors were encountered.getParseException
in interface ParsedField
null
if the field is valid.ParsedField.getParseException()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2004-2012. All Rights Reserved.