public class CharsetMatch extends java.lang.Object implements java.lang.Comparable<CharsetMatch>
Modifier and Type | Field and Description |
---|---|
static int |
BOM
Bit flag indicating the match is based on the presence of a BOM.
|
static int |
DECLARED_ENCODING
Bit flag indicating he match is based on the declared encoding.
|
static int |
ENCODING_SCHEME
Bit flag indicating the match is based on the the encoding scheme.
|
static int |
LANG_STATISTICS
Bit flag indicating the match is based on language statistics.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(CharsetMatch other)
Compare to other CharsetMatch objects.
|
int |
getConfidence()
Get an indication of the confidence in the charset detected.
|
java.lang.String |
getLanguage()
Get the ISO code for the language of the detected charset.
|
int |
getMatchType()
Return flags indicating what it was about the input data
that caused this charset to be considered as a possible match.
|
java.lang.String |
getName()
Get the name of the detected charset.
|
java.io.Reader |
getReader()
Create a java.io.Reader for reading the Unicode character data corresponding
to the original byte data supplied to the Charset detect operation.
|
java.lang.String |
getString()
Create a Java String from Unicode character data corresponding
to the original byte data supplied to the Charset detect operation.
|
java.lang.String |
getString(int maxLength)
Create a Java String from Unicode character data corresponding
to the original byte data supplied to the Charset detect operation.
|
public static final int ENCODING_SCHEME
getMatchType()
,
Constant Field Valuespublic static final int BOM
getMatchType()
,
Constant Field Valuespublic static final int DECLARED_ENCODING
getMatchType()
,
Constant Field Valuespublic static final int LANG_STATISTICS
getMatchType()
,
Constant Field Valuespublic java.io.Reader getReader()
public java.lang.String getString() throws java.io.IOException
java.io.IOException
public java.lang.String getString(int maxLength) throws java.io.IOException
maxLength
- The maximium length of the String to be created when the
source of the data is an input stream, or -1 for
unlimited length.java.io.IOException
public int getConfidence()
public int getMatchType()
Note: currently, this method always returns zero.
public java.lang.String getName()
Charset
,
InputStreamReader
public java.lang.String getLanguage()
null
if the language cannot be determined.public int compareTo(CharsetMatch other)
compareTo
in interface java.lang.Comparable<CharsetMatch>
other
- the CharsetMatch object to compare against.java.lang.ClassCastException
- if the argument is not a CharsetMatch.Copyright (c) 2011 IBM Corporation and others.