01: /*
02: * @(#)FileReader.java 1.17 06/10/10
03: *
04: * Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved.
05: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License version
09: * 2 only, as published by the Free Software Foundation.
10: *
11: * This program is distributed in the hope that it will be useful, but
12: * WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * General Public License version 2 for more details (a copy is
15: * included at /legal/license.txt).
16: *
17: * You should have received a copy of the GNU General Public License
18: * version 2 along with this work; if not, write to the Free Software
19: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA
21: *
22: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
23: * Clara, CA 95054 or visit www.sun.com if you need additional
24: * information or have any questions.
25: *
26: */
27:
28: package java.io;
29:
30: /**
31: * Convenience class for reading character files. The constructors of this
32: * class assume that the default character encoding and the default byte-buffer
33: * size are appropriate. To specify these values yourself, construct an
34: * InputStreamReader on a FileInputStream.
35: *
36: * <p><code>FileReader</code> is meant for reading streams of characters.
37: * For reading streams of raw bytes, consider using a
38: * <code>FileInputStream</code>.
39: *
40: * @see InputStreamReader
41: * @see FileInputStream
42: *
43: * @version 1.10, 00/02/02
44: * @author Mark Reinhold
45: * @since JDK1.1
46: */
47: public class FileReader extends InputStreamReader {
48:
49: /**
50: * Creates a new <tt>FileReader</tt>, given the name of the
51: * file to read from.
52: *
53: * @param fileName the name of the file to read from
54: * @exception FileNotFoundException if the named file does not exist,
55: * is a directory rather than a regular file,
56: * or for some other reason cannot be opened for
57: * reading.
58: */
59: public FileReader(String fileName) throws FileNotFoundException {
60: super (new FileInputStream(fileName));
61: }
62:
63: /**
64: * Creates a new <tt>FileReader</tt>, given the <tt>File</tt>
65: * to read from.
66: *
67: * @param file the <tt>File</tt> to read from
68: * @exception FileNotFoundException if the file does not exist,
69: * is a directory rather than a regular file,
70: * or for some other reason cannot be opened for
71: * reading.
72: */
73: public FileReader(File file) throws FileNotFoundException {
74: super (new FileInputStream(file));
75: }
76:
77: /**
78: * Creates a new <tt>FileReader</tt>, given the
79: * <tt>FileDescriptor</tt> to read from.
80: *
81: * @param fd the FileDescriptor to read from
82: */
83: public FileReader(FileDescriptor fd) {
84: super (new FileInputStream(fd));
85: }
86:
87: }
|