public abstract class BaseEncodingSniffer extends Object implements EncodingSniffer
Modifier and Type | Field and Description |
---|---|
protected static String |
CHARSET_TOKEN |
protected static String |
HTTP_CONTENT_TYPE_HEADER |
Constructor and Description |
---|
BaseEncodingSniffer() |
Modifier and Type | Method and Description |
---|---|
protected String |
contentTypeToCharset(String contentType)
return character encoding from content-type, if specified
and valid.
|
protected boolean |
isCharsetSupported(String charsetName)
test if
charsetName is supported by Java. |
protected String |
mapCharset(String orig) |
abstract String |
sniff(Resource resource) |
protected static final String CHARSET_TOKEN
protected static final String HTTP_CONTENT_TYPE_HEADER
public abstract String sniff(Resource resource)
sniff
in interface EncodingSniffer
protected boolean isCharsetSupported(String charsetName)
charsetName
is supported by Java.charsetName
- character encoding nametrue
if supported.protected String contentTypeToCharset(String contentType)
some encoding names are replaced. see mapCharset(String)
contentType
- content-type text, ex. "text/html; charset=shift_jis"
"shift_jis"
, or null
character encoding is unspecified, or invalid.Copyright © 2005–2015 IIPC. All rights reserved.