edu.stanford.nlp.io
Class EncodingFileReader

java.lang.Object
  extended by java.io.Reader
      extended by java.io.InputStreamReader
          extended by edu.stanford.nlp.io.EncodingFileReader
All Implemented Interfaces:
Closeable, Readable

public class EncodingFileReader
extends InputStreamReader

This is a convenience class which works almost exactly like FileReader but allows for the specification of input encoding.

Author:
Alex Kleeman

Field Summary
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
EncodingFileReader(File file)
          Creates a new EncodingFileReader, given the File to read from, and using default of utf-8.
EncodingFileReader(FileDescriptor fd)
          Creates a new FileReader, given the FileDescriptor to read from.
EncodingFileReader(File file, String encoding)
          Creates a new FileReader, given the File to read from and encoding.
EncodingFileReader(String fileName)
          Creates a new EncodingFileReader, given the name of the file to read from.
EncodingFileReader(String fileName, String encoding)
          Creates a new EncodingFileReader, given the name of the file to read from and an encoding
 
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

EncodingFileReader

public EncodingFileReader(String fileName)
                   throws UnsupportedEncodingException,
                          FileNotFoundException
Creates a new EncodingFileReader, given the name of the file to read from.

Parameters:
fileName - the name of the file to read from
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.
UnsupportedEncodingException - if the encoding does not exist.

EncodingFileReader

public EncodingFileReader(String fileName,
                          String encoding)
                   throws UnsupportedEncodingException,
                          FileNotFoundException
Creates a new EncodingFileReader, given the name of the file to read from and an encoding

Parameters:
fileName - the name of the file to read from
encoding - String specifying the encoding to be used
Throws:
UnsupportedEncodingException - if the encoding does not exist.
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.

EncodingFileReader

public EncodingFileReader(File file)
                   throws UnsupportedEncodingException,
                          FileNotFoundException
Creates a new EncodingFileReader, given the File to read from, and using default of utf-8.

Parameters:
file - the File to read from
Throws:
FileNotFoundException - if the file does not exist, is a directory rather than a regular file, or for some other reason cannot be opened for reading.
UnsupportedEncodingException - if the encoding does not exist.

EncodingFileReader

public EncodingFileReader(File file,
                          String encoding)
                   throws UnsupportedEncodingException,
                          FileNotFoundException
Creates a new FileReader, given the File to read from and encoding.

Parameters:
file - the File to read from
encoding - String specifying the encoding to be used
Throws:
FileNotFoundException - if the file does not exist, is a directory rather than a regular file, or for some other reason cannot be opened for reading.
UnsupportedEncodingException - if the encoding does not exist.

EncodingFileReader

public EncodingFileReader(FileDescriptor fd)
Creates a new FileReader, given the FileDescriptor to read from.

Parameters:
fd - the FileDescriptor to read from


Stanford NLP Group