java.lang.Object
org.mozilla.universalchardet.ReaderFactory

public final class ReaderFactory extends Object
Create a reader from a file with correct encoding
  • Constructor Details

    • ReaderFactory

      private ReaderFactory()
  • Method Details

    • createBufferedReader

      public static BufferedReader createBufferedReader(File file, Charset defaultCharset) throws IOException
      Create a reader from a file with correct encoding
      Parameters:
      file - The file to read from
      defaultCharset - defaultCharset to use if can't be determined
      Returns:
      BufferedReader for the file with the correct encoding
      Throws:
      IOException - if some I/O error ocurrs
    • createBufferedReader

      public static BufferedReader createBufferedReader(File file) throws IOException
      Create a reader from a file with correct encoding. If charset cannot be determined, it uses the system default charset.
      Parameters:
      file - The file to read from
      Returns:
      BufferedReader for the file with the correct encoding
      Throws:
      IOException - if some I/O error ocurrs
    • createReaderFromFile

      @Deprecated public static Reader createReaderFromFile(File file, Charset defaultCharset) throws IOException
      Create a reader from a file with the correct encoding
      Parameters:
      file - The file to read from
      defaultCharset - defaultCharset to use if can't be determined
      Returns:
      Reader for the file with the correct encoding
      Throws:
      IOException - if some I/O error ocurrs
    • createReaderFromFile

      @Deprecated public static Reader createReaderFromFile(File file) throws IOException
      Create a reader from a file with the correct encoding. If charset cannot be determined, it uses the system default charset.
      Parameters:
      file - The file to read from
      Returns:
      Reader for the file with the correct encoding
      Throws:
      IOException - if some I/O error ocurrs