Package org.mozilla.universalchardet
Class ReaderFactory
java.lang.Object
org.mozilla.universalchardet.ReaderFactory
Create a reader from a file with correct encoding
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BufferedReader
createBufferedReader
(File file) Create a reader from a file with correct encoding.static BufferedReader
createBufferedReader
(File file, Charset defaultCharset) Create a reader from a file with correct encodingstatic Reader
createReaderFromFile
(File file) Deprecated.static Reader
createReaderFromFile
(File file, Charset defaultCharset) Deprecated.
-
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 fromdefaultCharset
- 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
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 Deprecated.Create a reader from a file with the correct encoding- Parameters:
file
- The file to read fromdefaultCharset
- 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.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
-
createBufferedReader(File)