public final class MimeHelper extends Object
Modifier and Type | Class and Description |
---|---|
protected static class |
MimeHelper.HeaderTokenizer |
protected static class |
MimeHelper.ParseException |
protected static class |
MimeHelper.Token |
Modifier and Type | Field and Description |
---|---|
static String |
CONTENT_DISPOSITION |
static String |
DISPOSITION_ATTACHMENT |
static String |
DISPOSITION_FILENAME |
static String |
DISPOSITION_FORM_DATA_CONTENT |
static String |
DISPOSITION_INLINE |
static String |
DISPOSITION_NAME |
Modifier and Type | Method and Description |
---|---|
static String |
decodeContentDisposition(String value,
Map<String,String> params)
Decodes the Content-Disposition header value according to RFC 2183 and
RFC 2231.
|
static String |
decodeContentDispositionFilename(String value)
Decodes a filename from the Content-Disposition header value according to
RFC 2183 and RFC 2231.
|
protected static String |
decodeRFC2231value(String value) |
static String |
encodeContentDisposition(String disposition,
String filename)
Encodes the Content-Disposition header value according to RFC 2183 and
RFC 2231.
|
protected static String |
encodeRFC2231(String key,
String value)
Encodes a MIME parameter per RFC 2231.
|
protected static boolean |
encodeRFC2231value(String value,
StringBuilder buf)
Encodes a value per RFC 2231.
|
protected static byte[] |
fromHex(String data) |
static byte[] |
getBoundaryFromMultiPart(String value)
Gets the boundary from a
multipart/formdata content type
header. |
static String |
getCharsetFromContentType(String value)
Gets charset from a content type header.
|
protected static String |
getJavaCharset(String mimeCharset) |
protected static Map<String,String> |
getParameters(String list,
Map<String,String> params) |
public static final String CONTENT_DISPOSITION
public static final String DISPOSITION_ATTACHMENT
public static final String DISPOSITION_INLINE
public static final String DISPOSITION_FILENAME
public static final String DISPOSITION_NAME
public static final String DISPOSITION_FORM_DATA_CONTENT
protected static boolean encodeRFC2231value(String value, StringBuilder buf)
This is used to pass non-ASCII parameters to MIME parameter lists.
This implementation always uses UTF-8 and no language.
See RFC 2231 for details.
value
- the value to encodebuf
- the buffer to filltrue
if an encoding was needed, or false
if no
encoding was actually neededprotected static String encodeRFC2231(String key, String value)
This implementation always uses UTF-8 and no language.
See RFC 2231 for details.
value
- the string to encodepublic static String encodeContentDisposition(String disposition, String filename)
See RFC 2231 for details.
disposition
- the dispositionfilename
- the file namepublic static String decodeContentDispositionFilename(String value)
See RFC 2231 for details.
value
- the header value to decodepublic static String decodeContentDisposition(String value, Map<String,String> params)
Does not deal with continuation lines.
See RFC 2231 for details.
value
- the header value to decodeparams
- the map of parameters to fillpublic static String getCharsetFromContentType(String value)
value
- the header value to decodenull
if no valid boundary availablepublic static byte[] getBoundaryFromMultiPart(String value)
multipart/formdata
content type
header.value
- the header value to decodenull
if no valid
boundary availableprotected static Map<String,String> getParameters(String list, Map<String,String> params) throws MimeHelper.ParseException
MimeHelper.ParseException
protected static byte[] fromHex(String data)
Copyright © 2009-2014 The Apache Software Foundation. All Rights Reserved.