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 Details

    • FileEncoding

      public FileEncoding()
  • Method Details

    • 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)