KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > io > FileReader


1 /*
2  * @(#)FileReader.java 1.15 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.io;
9
10
11 /**
12  * Convenience class for reading character files. The constructors of this
13  * class assume that the default character encoding and the default byte-buffer
14  * size are appropriate. To specify these values yourself, construct an
15  * InputStreamReader on a FileInputStream.
16  *
17  * <p><code>FileReader</code> is meant for reading streams of characters.
18  * For reading streams of raw bytes, consider using a
19  * <code>FileInputStream</code>.
20  *
21  * @see InputStreamReader
22  * @see FileInputStream
23  *
24  * @version 1.15, 03/12/19
25  * @author Mark Reinhold
26  * @since JDK1.1
27  */

28 public class FileReader extends InputStreamReader JavaDoc {
29
30    /**
31     * Creates a new <tt>FileReader</tt>, given the name of the
32     * file to read from.
33     *
34     * @param fileName the name of the file to read from
35     * @exception FileNotFoundException if the named file does not exist,
36     * is a directory rather than a regular file,
37     * or for some other reason cannot be opened for
38     * reading.
39     */

40     public FileReader(String JavaDoc fileName) throws FileNotFoundException JavaDoc {
41     super(new FileInputStream JavaDoc(fileName));
42     }
43
44    /**
45     * Creates a new <tt>FileReader</tt>, given the <tt>File</tt>
46     * to read from.
47     *
48     * @param file the <tt>File</tt> to read from
49     * @exception FileNotFoundException if the file does not exist,
50     * is a directory rather than a regular file,
51     * or for some other reason cannot be opened for
52     * reading.
53     */

54     public FileReader(File JavaDoc file) throws FileNotFoundException JavaDoc {
55     super(new FileInputStream JavaDoc(file));
56     }
57
58    /**
59     * Creates a new <tt>FileReader</tt>, given the
60     * <tt>FileDescriptor</tt> to read from.
61     *
62     * @param fd the FileDescriptor to read from
63     */

64     public FileReader(FileDescriptor JavaDoc fd) {
65     super(new FileInputStream JavaDoc(fd));
66     }
67
68 }
69
70
Popular Tags