Package org.freebsd.file
Class FileEncoding
- java.lang.Object
-
- org.freebsd.file.FileEncoding
-
public class FileEncoding extends Object
Tries to guess the encoding of the byte sequence. Orignial code taken from https://github.com/file/file/blob/master/src/encoding.c
-
-
Constructor Summary
Constructors Constructor Description FileEncoding()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetCode()StringgetCodeMime()StringgetType()booleanguessFileEncoding(byte[] buf)Try to determine whether text is in some character code we can identify.protected intlooksUtf8(byte[] buf, int nbytes)
-
-
-
Method Detail
-
getCodeMime
public String getCodeMime()
-
getType
public String getType()
-
getCode
public String getCode()
-
guessFileEncoding
public boolean guessFileEncoding(byte[] buf)
Try to determine whether text is in some character code we can identify. It also identifies EBCDIC by converting it to ISO-8859-1.- Returns:
- true if it could guess an encoding.
-
looksUtf8
protected int looksUtf8(byte[] buf, int nbytes)
-
-