java.lang.Object
org.glavo.chardet.UniversalDetector
-
嵌套类概要
嵌套类 -
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voiddataEnd()Marks end of data reading.static DetectedCharsetdetectCharset(File file) Gets the charset of a File.static DetectedCharsetdetectCharset(InputStream inputStream) Gets the charset of content from InputStream.static DetectedCharsetdetectCharset(Path path) Gets the charset of a Path.static DetectedCharsetdetectCharsetFromBOM(byte[] buf) voidhandleData(byte[] buf) Feed the detector with more data.voidhandleData(byte[] buf, int offset, int length) Feed the detector with more data.voidhandleData(ByteBuffer buf) Feed the detector with more data.voidhandleData(ByteBuffer buf, int offset, int length) Feed the detector with more data.booleanisDone()voidreset()Resets detector to be used again.voidsetListener(CharsetListener listener)
-
字段详细资料
-
SHORTCUT_THRESHOLD
public static final float SHORTCUT_THRESHOLD- 另请参阅:
-
MINIMUM_THRESHOLD
public static final float MINIMUM_THRESHOLD- 另请参阅:
-
-
构造器详细资料
-
UniversalDetector
public UniversalDetector() -
UniversalDetector
- 参数:
listener- a listener object that is notified of the detected encocoding. Can be null.
-
-
方法详细资料
-
isDone
public boolean isDone() -
getDetectedCharset
- 返回:
- The detected encoding is returned. If the detector couldn't determine what encoding was used, null is returned.
-
setListener
-
getListener
-
handleData
public void handleData(byte[] buf) Feed the detector with more data.- 参数:
buf- Buffer with the data
-
handleData
public void handleData(byte[] buf, int offset, int length) Feed the detector with more data.- 参数:
buf- Buffer with the dataoffset- initial position of data in buflength- length of data
-
handleData
Feed the detector with more data.This method only reads the
bufand does not change its position.- 参数:
buf- Buffer with the data
-
handleData
Feed the detector with more data.This method only reads the
bufand does not change its position.- 参数:
buf- Buffer with the dataoffset- initial position of data in buflength- length of data
-
detectCharsetFromBOM
-
dataEnd
public void dataEnd()Marks end of data reading. Finish calculations. -
reset
public void reset()Resets detector to be used again. -
detectCharset
Gets the charset of a File.- 参数:
file- The file to check charset for- 返回:
- The charset of the file, null if it cannot be determined
- 抛出:
IOException- if some IO error occurs
-
detectCharset
Gets the charset of a Path.- 参数:
path- The path to file to check charset for- 返回:
- The charset of the file, null if it cannot be determined
- 抛出:
IOException- if some IO error occurs
-
detectCharset
Gets the charset of content from InputStream.- 参数:
inputStream- InputStream containing text file- 返回:
- The charset of the file, null if it cannot be determined
- 抛出:
IOException- if some IO error occurs
-