Class FileEncoding
java.lang.Object
org.freebsd.file.FileEncoding
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 -
Method Summary
Modifier and TypeMethodDescriptiongetCode()
getType()
boolean
guessFileEncoding
(byte[] buf) Try to determine whether text is in some character code we can identify.protected int
looksUtf8
(byte[] buf, int nbytes)
-
Constructor Details
-
FileEncoding
public FileEncoding()
-
-
Method Details
-
getCodeMime
-
getType
-
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)
-