Package org.apache.james.mime4j.field
Class ContentDispositionFieldImpl
- java.lang.Object
-
- org.apache.james.mime4j.field.AbstractField
-
- org.apache.james.mime4j.field.ContentDispositionFieldImpl
-
- All Implemented Interfaces:
ContentDispositionField,ParsedField,Field
public class ContentDispositionFieldImpl extends AbstractField implements ContentDispositionField
Represents aContent-Dispositionfield.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.DatecreationDateprivate booleancreationDateParsedprivate java.lang.StringdispositionTypeprivate java.util.DatemodificationDateprivate booleanmodificationDateParsedprivate java.util.Map<java.lang.String,java.lang.String>parametersprivate booleanparsedprivate ParseExceptionparseExceptionstatic FieldParser<ContentDispositionField>PARSERprivate java.util.DatereadDateprivate booleanreadDateParsed-
Fields inherited from class org.apache.james.mime4j.field.AbstractField
monitor, rawField
-
Fields inherited from interface org.apache.james.mime4j.dom.field.ContentDispositionField
DISPOSITION_TYPE_ATTACHMENT, DISPOSITION_TYPE_INLINE, PARAM_CREATION_DATE, PARAM_FILENAME, PARAM_MODIFICATION_DATE, PARAM_READ_DATE, PARAM_SIZE
-
-
Constructor Summary
Constructors Constructor Description ContentDispositionFieldImpl(Field rawField, DecodeMonitor monitor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.DategetCreationDate()Gets the value of thecreation-dateparameter if set and valid.java.lang.StringgetDispositionType()Gets the disposition type defined in this Content-Disposition field.java.lang.StringgetFilename()Gets the value of thefilenameparameter if set.java.util.DategetModificationDate()Gets the value of themodification-dateparameter if set and valid.java.lang.StringgetParameter(java.lang.String name)Gets the value of a parameter.java.util.Map<java.lang.String,java.lang.String>getParameters()Gets all parameters.ParseExceptiongetParseException()Gets the exception that was raised during parsing of the field value, if any; otherwise, null.java.util.DategetReadDate()Gets the value of theread-dateparameter if set and valid.longgetSize()Gets the value of thesizeparameter if set and valid.booleanisAttachment()Returntrueif the disposition type of this field is attachment,falseotherwise.booleanisDispositionType(java.lang.String dispositionType)Determines if the disposition type of this field matches the given one.booleanisInline()Returntrueif the disposition type of this field is inline,falseotherwise.private voidparse()private java.util.DateparseDate(java.lang.String paramName)-
Methods inherited from class org.apache.james.mime4j.field.AbstractField
getBody, getName, getNameLowerCase, getRaw, getRawField, isValidField, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.james.mime4j.dom.field.ContentDispositionField
bodyDescriptionField
-
Methods inherited from interface org.apache.james.mime4j.stream.Field
getBody, getName, getNameLowerCase, getRaw
-
Methods inherited from interface org.apache.james.mime4j.dom.field.ParsedField
isValidField
-
-
-
-
Field Detail
-
parsed
private boolean parsed
-
dispositionType
private java.lang.String dispositionType
-
parameters
private final java.util.Map<java.lang.String,java.lang.String> parameters
-
parseException
private ParseException parseException
-
creationDateParsed
private boolean creationDateParsed
-
creationDate
private java.util.Date creationDate
-
modificationDateParsed
private boolean modificationDateParsed
-
modificationDate
private java.util.Date modificationDate
-
readDateParsed
private boolean readDateParsed
-
readDate
private java.util.Date readDate
-
PARSER
public static final FieldParser<ContentDispositionField> PARSER
-
-
Constructor Detail
-
ContentDispositionFieldImpl
ContentDispositionFieldImpl(Field rawField, DecodeMonitor monitor)
-
-
Method Detail
-
getParseException
public ParseException getParseException()
Gets the exception that was raised during parsing of the field value, if any; otherwise, null.- Specified by:
getParseExceptionin interfaceParsedField- Overrides:
getParseExceptionin classAbstractField- Returns:
- the exception that was thrown by the field parser or
nullif the field is valid. - See Also:
ParsedField.getParseException()
-
getDispositionType
public java.lang.String getDispositionType()
Description copied from interface:ContentDispositionFieldGets the disposition type defined in this Content-Disposition field.- Specified by:
getDispositionTypein interfaceContentDispositionField- Returns:
- the disposition type or an empty string if not set.
- See Also:
ContentDispositionField.getDispositionType()
-
getParameter
public java.lang.String getParameter(java.lang.String name)
Description copied from interface:ContentDispositionFieldGets the value of a parameter. Parameter names are case-insensitive.- Specified by:
getParameterin interfaceContentDispositionField- Parameters:
name- the name of the parameter to get.- Returns:
- the parameter value or
nullif not set. - See Also:
ContentDispositionField.getParameter(java.lang.String)
-
getParameters
public java.util.Map<java.lang.String,java.lang.String> getParameters()
Description copied from interface:ContentDispositionFieldGets all parameters.- Specified by:
getParametersin interfaceContentDispositionField- Returns:
- the parameters.
- See Also:
ContentDispositionField.getParameters()
-
isDispositionType
public boolean isDispositionType(java.lang.String dispositionType)
Description copied from interface:ContentDispositionFieldDetermines if the disposition type of this field matches the given one.- Specified by:
isDispositionTypein interfaceContentDispositionField- Parameters:
dispositionType- the disposition type to match against.- Returns:
trueif the disposition type of this field matches,falseotherwise.- See Also:
ContentDispositionField.isDispositionType(java.lang.String)
-
isInline
public boolean isInline()
Description copied from interface:ContentDispositionFieldReturntrueif the disposition type of this field is inline,falseotherwise.- Specified by:
isInlinein interfaceContentDispositionField- Returns:
trueif the disposition type of this field is inline,falseotherwise.- See Also:
ContentDispositionField.isInline()
-
isAttachment
public boolean isAttachment()
Description copied from interface:ContentDispositionFieldReturntrueif the disposition type of this field is attachment,falseotherwise.- Specified by:
isAttachmentin interfaceContentDispositionField- Returns:
trueif the disposition type of this field is attachment,falseotherwise.- See Also:
ContentDispositionField.isAttachment()
-
getFilename
public java.lang.String getFilename()
Description copied from interface:ContentDispositionFieldGets the value of thefilenameparameter if set.- Specified by:
getFilenamein interfaceContentDispositionField- Returns:
- the
filenameparameter value ornullif not set. - See Also:
ContentDispositionField.getFilename()
-
getCreationDate
public java.util.Date getCreationDate()
Description copied from interface:ContentDispositionFieldGets the value of thecreation-dateparameter if set and valid.- Specified by:
getCreationDatein interfaceContentDispositionField- Returns:
- the
creation-dateparameter value ornullif not set or invalid. - See Also:
ContentDispositionField.getCreationDate()
-
getModificationDate
public java.util.Date getModificationDate()
Description copied from interface:ContentDispositionFieldGets the value of themodification-dateparameter if set and valid.- Specified by:
getModificationDatein interfaceContentDispositionField- Returns:
- the
modification-dateparameter value ornullif not set or invalid. - See Also:
ContentDispositionField.getModificationDate()
-
getReadDate
public java.util.Date getReadDate()
Description copied from interface:ContentDispositionFieldGets the value of theread-dateparameter if set and valid.- Specified by:
getReadDatein interfaceContentDispositionField- Returns:
- the
read-dateparameter value ornullif not set or invalid. - See Also:
ContentDispositionField.getReadDate()
-
getSize
public long getSize()
Description copied from interface:ContentDispositionFieldGets the value of thesizeparameter if set and valid.- Specified by:
getSizein interfaceContentDispositionField- Returns:
- the
sizeparameter value or-1if not set or invalid. - See Also:
ContentDispositionField.getSize()
-
parseDate
private java.util.Date parseDate(java.lang.String paramName)
-
parse
private void parse()
-
-