org.zkoss.io
Class FileReader

java.lang.Object
  extended by java.io.Reader
      extended by java.io.InputStreamReader
          extended by org.zkoss.io.FileReader
All Implemented Interfaces:
java.io.Closeable, java.lang.Readable

public class FileReader
extends java.io.InputStreamReader

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
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
FileReader(java.io.FileDescriptor fd, java.lang.String charset)
          Creates a new FileReader, given the FileDescriptor to read from.
FileReader(java.io.File file, java.lang.String charset)
          Creates a new FileReader, given the File instance to read from.
FileReader(java.lang.String filename, java.lang.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, ready
 
Methods inherited from class java.io.Reader
mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileReader

public FileReader(java.lang.String filename,
                  java.lang.String charset)
           throws java.io.IOException
Creates a new FileReader, given the name of the file to read from.

Parameters:
filename - the name of the file to read from
charset - the charset to decode the file, such as UTF-8. If null, UTF-8 is assumed.
Throws:
java.io.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.
java.io.IOException

FileReader

public FileReader(java.io.File file,
                  java.lang.String charset)
           throws java.io.IOException
Creates a new FileReader, given the File instance to read from.

Parameters:
file - the File to read from
charset - the charset to decode the file, such as UTF-8. If null, UTF-8 is assumed.
Throws:
java.io.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.
java.io.IOException

FileReader

public FileReader(java.io.FileDescriptor fd,
                  java.lang.String charset)
           throws java.io.IOException
Creates a new FileReader, given the FileDescriptor to read from.

Parameters:
fd - the FileDescriptor to read from
charset - the charset to decode the file, such as UTF-8. If null, UTF-8 is assumed.
Throws:
java.io.IOException


Copyright © 2005-2011 Potix Corporation. All Rights Reserved. SourceForge.net Logo