Package org.meteoinfo.io
Class FileCharsetDetector
- java.lang.Object
-
- org.meteoinfo.io.FileCharsetDetector
-
public class FileCharsetDetector extends java.lang.Object借助JCharDet获取文件字符集
-
-
Constructor Summary
Constructors Constructor Description FileCharsetDetector()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringguestFileEncoding(java.io.File file)传入一个文件(File)对象,检查文件编码java.lang.StringguestFileEncoding(java.io.File file, int languageHint)获取文件的编码java.lang.StringguestFileEncoding(java.lang.String path)获取文件的编码java.lang.StringguestFileEncoding(java.lang.String path, int languageHint)获取文件的编码
-
-
-
Method Detail
-
guestFileEncoding
public java.lang.String guestFileEncoding(java.io.File file) throws java.io.FileNotFoundException, java.io.IOException传入一个文件(File)对象,检查文件编码- Parameters:
file- File对象实例- Returns:
- 文件编码,若无,则返回null
- Throws:
java.io.FileNotFoundExceptionjava.io.IOException
-
guestFileEncoding
public java.lang.String guestFileEncoding(java.io.File file, int languageHint) throws java.io.FileNotFoundException, java.io.IOException获取文件的编码- Parameters:
file- File对象实例languageHint- 语言提示区域代码 eg:1 : Japanese; 2 : Chinese; 3 : Simplified Chinese; 4 : Traditional Chinese; 5 : Korean; 6 : Dont know (default)- Returns:
- 文件编码,eg:UTF-8,GBK,GB2312形式,若无,则返回null
- Throws:
java.io.FileNotFoundExceptionjava.io.IOException
-
guestFileEncoding
public java.lang.String guestFileEncoding(java.lang.String path) throws java.io.FileNotFoundException, java.io.IOException获取文件的编码- Parameters:
path- 文件路径- Returns:
- 文件编码,eg:UTF-8,GBK,GB2312形式,若无,则返回null
- Throws:
java.io.FileNotFoundExceptionjava.io.IOException
-
guestFileEncoding
public java.lang.String guestFileEncoding(java.lang.String path, int languageHint) throws java.io.FileNotFoundException, java.io.IOException获取文件的编码- Parameters:
path- 文件路径languageHint- 语言提示区域代码 eg:1 : Japanese; 2 : Chinese; 3 : Simplified Chinese; 4 : Traditional Chinese; 5 : Korean; 6 : Dont know (default)- Returns:
- Throws:
java.io.FileNotFoundExceptionjava.io.IOException
-
-