public class CharsetDetector extends Object
| Constructor and Description |
|---|
CharsetDetector() |
| Modifier and Type | Method and Description |
|---|---|
static Charset |
detect(File file,
Charset... charsets)
探测文件编码
|
static Charset |
detect(InputStream in,
Charset... charsets)
探测编码
注意:此方法会读取流的一部分,然后关闭流,如重复使用流,请使用支持reset方法的流 |
static Charset |
detect(int bufferSize,
InputStream in,
Charset... charsets)
探测编码
注意:此方法会读取流的一部分,然后关闭流,如重复使用流,请使用支持reset方法的流 |
public static Charset detect(File file, Charset... charsets)
file - 文件charsets - 需要测试用的编码,null或空使用默认的编码数组public static Charset detect(InputStream in, Charset... charsets)
in - 流,使用后关闭此流charsets - 需要测试用的编码,null或空使用默认的编码数组public static Charset detect(int bufferSize, InputStream in, Charset... charsets)
bufferSize - 自定义缓存大小,即每次检查的长度in - 流,使用后关闭此流charsets - 需要测试用的编码,null或空使用默认的编码数组Copyright © 2025. All rights reserved.