类 ReaderFactory

java.lang.Object
org.glavo.chardet.ReaderFactory

public final class ReaderFactory extends Object
Create a reader from a file with correct encoding
  • 方法详细资料

    • createBufferedReader

      public static BufferedReader createBufferedReader(Path file, Charset defaultCharset) throws IOException
      Create a reader from a file with correct encoding
      参数:
      file - The file to read from
      defaultCharset - defaultCharset to use if it can't be determined
      返回:
      BufferedReader for the file with the correct encoding
      抛出:
      IOException - if some I/O error occurs
    • createBufferedReader

      public static BufferedReader createBufferedReader(Path file) throws IOException
      Create a reader from a file with correct encoding. If charset cannot be determined, it uses the UTF-8.
      参数:
      file - The file to read from
      返回:
      BufferedReader for the file with the correct encoding
      抛出:
      IOException - if some I/O error occurs
    • createBufferedReader

      public static BufferedReader createBufferedReader(byte[] data, Charset defaultCharset) throws IOException
      Create a reader from a byte array with correct encoding
      参数:
      data - The byte[] to read from
      defaultCharset - defaultCharset to use if can't be determined
      返回:
      BufferedReader for the file with the correct encoding
      抛出:
      IOException - if some I/O error occurs
    • createBufferedReader

      public static BufferedReader createBufferedReader(byte[] data) throws IOException
      Create a reader from a byte array with correct encoding. If charset cannot be determined, it uses the UTF-8.
      参数:
      data - The byte[] to read from
      返回:
      BufferedReader for the file with the correct encoding
      抛出:
      IOException - if some I/O error occurs