public class MimeHeader extends java.lang.Object implements Streamable, java.io.Serializable
Header
to convieniently access Mime-Specific header
fields.Modifier and Type | Field and Description |
---|---|
static int |
BASE64
Transfer encoding.
|
static int |
PLAIN
Transfer encoding.
|
static int |
QUOTED_PRINTABLE
Transfer encoding.
|
Constructor and Description |
---|
MimeHeader()
Constructs a MimeHeader with a new instanciated
Header . |
MimeHeader(Header header)
Constructs a MimeHeader from a
Header |
MimeHeader(java.lang.String type,
java.lang.String subtype)
Constructs a MimeHeader with a new instanciated
Header . |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
appendParameter(java.lang.String headerLine,
java.lang.String key,
java.lang.String value) |
int |
count() |
java.lang.String |
get(java.lang.String key)
Get the Header for the specified key.
|
java.nio.charset.Charset |
getCharset()
Gets the charset this mime-part is encoded in.
|
java.lang.String |
getContentDescription()
Gets the content description of the mime-part.
|
java.lang.String |
getContentDisposition()
Gets the content-disposition of the mime-part.
|
java.lang.String |
getContentID()
Gets the content id of the mime-part.
|
java.lang.String |
getContentParameter(java.lang.String key)
Gets a content parameter of the mime-part.
|
java.lang.String |
getContentSubtype()
Deprecated.
Use
getMimeType() instead |
int |
getContentTransferEncoding()
Gets the content transfer encoding of the mime-part.
|
java.lang.String |
getContentType()
Deprecated.
Use
getMimeType() instead |
java.lang.String |
getDispositionParameter(java.lang.String key)
Gets a parameter of the content disposition of the mime-part.
|
java.lang.String |
getFileName()
Gets the filename of the mime-part.
|
Header |
getHeader() |
java.io.InputStream |
getInputStream() |
MimeType |
getMimeType()
Gets the
MimeType of the mime-part. |
protected java.lang.String |
getParameter(java.lang.String headerLine,
java.lang.String key) |
void |
putContentParameter(java.lang.String key,
java.lang.String value)
Adds a content parameter to the mime-part.
|
void |
putDispositionParameter(java.lang.String key,
java.lang.String value)
Adds a parameter to the content disposition of the mime-part.
|
void |
set(java.lang.String key,
java.lang.Object value)
Set the header with the specified value.
|
void |
setContentDescription(java.lang.String description)
Sets the content description of the mime-part.
|
void |
setContentDisposition(java.lang.String disposition)
Sets the content-disposition of the mime-part.
|
void |
setContentID(java.lang.String id)
Sets the content id of the mime-part.
|
void |
setContentTransferEncoding(java.lang.String encoding)
Sets the content transfer encoding of the mime-part.
|
void |
setHeader(Header header)
Set the Header.
|
void |
setMimeType(MimeType type)
Sets the mime-type of the mime-part.
|
java.lang.String |
toString() |
public static final int PLAIN
public static final int QUOTED_PRINTABLE
public static final int BASE64
public MimeHeader()
public MimeHeader(Header header)
Header
header
- public MimeHeader(java.lang.String type, java.lang.String subtype)
Header
.
type
- type of the mime-part (e.g. text)subtype
- subtype of the mime-part (e.g. plain)public MimeType getMimeType()
MimeType
of the mime-part.
Intern the MimeTypeParser
is used to parse the headerfield
"Content-Type" to retrieve the mimetype.
MimeType
of the mime-partpublic java.lang.String getContentType()
getMimeType()
insteadpublic java.lang.String getContentSubtype()
getMimeType()
insteadpublic java.lang.String getContentDisposition()
See RFC2183
public java.lang.String getContentParameter(java.lang.String key)
See RFC2045
key
- the parameter name (e.g. boundary)public int getContentTransferEncoding()
See RFC2045 for more information about the encodings.
public java.lang.String getContentID()
See RFC2393.
public java.lang.String getContentDescription()
See RFC2045
public java.lang.String getDispositionParameter(java.lang.String key)
See RFC2183
key
- protected java.lang.String getParameter(java.lang.String headerLine, java.lang.String key)
protected java.lang.String appendParameter(java.lang.String headerLine, java.lang.String key, java.lang.String value)
public java.lang.String getFileName()
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public void putContentParameter(java.lang.String key, java.lang.String value)
Note: Make sure that you called setMimeType(MimeType)
before you call this method, because it will erase all previously
added parameters
See RFC2045
key
- the parameter name (e.g. boundary)value
- the value of the parameterpublic void putDispositionParameter(java.lang.String key, java.lang.String value)
Note: Make sure that you called setContentDisposition(String)
before you call this method, because it will erase all previously
added parameters
See RFC2183
key
- value
- public void setMimeType(MimeType type)
See RFC2046 for more mime-types
type
- MimeType
of the mime-partpublic void setContentDescription(java.lang.String description)
Note: Make sure that you called this method before you call
putContentParameter(String,String)
, because it will erase all
previously added parameters
See RFC2045
description
- of the mime-partpublic void setContentDisposition(java.lang.String disposition)
Note: Make sure that you called this method before you call
putDispositionParameter(String,String)
, because it will erase
all previously added parameters
See RFC2183
disposition
- of the messagepublic void setContentID(java.lang.String id)
See RFC2393.
id
- of the mime-partpublic void setContentTransferEncoding(java.lang.String encoding)
See RFC2045 for more information about the encodings.
encoding
- of the mime-partpublic int count()
public java.lang.String get(java.lang.String key)
key
- public void set(java.lang.String key, java.lang.Object value)
key
- value
- public java.nio.charset.Charset getCharset()
Charset
of the mime-partpublic Header getHeader()
public void setHeader(Header header)
header
- public java.io.InputStream getInputStream()
getInputStream
in interface Streamable
Streamable.getInputStream()
Copyright © 2021. All Rights Reserved.