ParsingDetector.
Future versions may drop this class.public class HTMLCodepageDetector extends AbstractCodepageDetector
This class has been replaced by ParsingDetector and only exists for backward-compatibility.
The name simply would not match any more, as parsing is not limited to html (1.1 includes xml as well). New code
should stick to the replacement. This class has been modified with version 1.1 and now is delegating all calls to an
instance of the replacement class (5 minutes with eclipse and a common interface), which introduces a small overhead
(minimal, as one invokevirtual is nothing compared to codepage detection by parsing).
Documentation may be found in the class ParsingDetector. It is valid for this class.
ParsingDetector,
序列化表格| 构造器和说明 |
|---|
HTMLCodepageDetector()
已过时。
|
HTMLCodepageDetector(boolean verbose)
已过时。
|
| 限定符和类型 | 方法和说明 |
|---|---|
int |
compareTo(Object o)
已过时。
|
Charset |
detectCodepage(InputStream in,
int length)
已过时。
This method allows to detect the charset encoding from every source (even a
String, which an URL does not decorate!).
|
Charset |
detectCodepage(URL url)
已过时。
Delegates to
ICodepageDetector.detectCodepage(java.io.InputStream, int) with a buffered input stream. |
boolean |
equals(Object obj)
已过时。
|
int |
hashCode()
已过时。
|
String |
toString()
已过时。
|
openpublic HTMLCodepageDetector()
public HTMLCodepageDetector(boolean verbose)
public int compareTo(Object o)
compareTo 在接口中 ComparablecompareTo 在类中 AbstractCodepageDetectorComparable.compareTo(Object)public Charset detectCodepage(InputStream in, int length) throws IOException
ICodepageDetectorThis method allows to detect the charset encoding from every source (even a String, which an URL does not decorate!).
Note that you cannot reuse the given InputStream unless it supports marking (InputStream.markSupported() ==
true), you mark the initial position with a sufficient readlimit and invoke
reset afterwards (without getting any exception).
in - An InputStream for the document, that supports mark and a
readlimit of argument length.length - The amount of bytes to take into account. This number should not
be longer than the amount of bytes retrievable from the
InputStream but should be as long as possible to give the fallback
detection (chardet) more hints to guess.IOExceptionpublic Charset detectCodepage(URL url) throws IOException
AbstractCodepageDetectorICodepageDetector.detectCodepage(java.io.InputStream, int) with a buffered input stream.
detectCodepage 在接口中 ICodepageDetectordetectCodepage 在类中 AbstractCodepageDetectorCharsetthat represents the
document's codepage.IOException - thrown to indicate that it is was not possible to open the
document specified by the given URL.ICodepageDetector.detectCodepage(URL)Copyright © 2016. All rights reserved.