Package org.zkoss.io
Class FileReader
java.lang.Object
java.io.Reader
java.io.InputStreamReader
org.zkoss.io.FileReader
- All Implemented Interfaces:
Closeable,AutoCloseable,Readable
Convenience class for reading character files.
Unlike java.io.FileReader, where the default character encoding is used,
it accepts different character encoding.
- Since:
- 3.0.8
- Author:
- tomyeh
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionFileReader(FileDescriptor fd, String charset) Creates a new FileReader, given the FileDescriptor to read from.FileReader(File file, String charset) Creates a new FileReader, given the File instance to read from.FileReader(String filename, String charset) Creates a new FileReader, given the name of the file to read from. -
Method Summary
Methods inherited from class java.io.InputStreamReader
close, getEncoding, read, read, read, readyMethods inherited from class java.io.Reader
mark, markSupported, nullReader, read, reset, skip, transferTo
-
Constructor Details
-
FileReader
Creates a new FileReader, given the name of the file to read from.- Parameters:
filename- the name of the file to read fromcharset- the charset to decode the file, such as UTF-8. If null, UTF-8 is assumed.- Throws:
FileNotFoundException- if the named file does not exist, is a directory rather than a regular file, or for some other reason cannot be opened for reading.IOException
-
FileReader
Creates a new FileReader, given the File instance to read from.- Parameters:
file- the File to read fromcharset- the charset to decode the file, such as UTF-8. If null, UTF-8 is assumed.- Throws:
FileNotFoundException- if the named file does not exist, is a directory rather than a regular file, or for some other reason cannot be opened for reading.IOException
-
FileReader
Creates a new FileReader, given the FileDescriptor to read from.- Parameters:
fd- the FileDescriptor to read fromcharset- the charset to decode the file, such as UTF-8. If null, UTF-8 is assumed.- Throws:
IOException
-