01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: package java.io;
19:
20: /**
21: * FileReader is class for turning a file into a character Stream. Data read
22: * from the source is converted into characters. The encoding is assumed to
23: * 8859_1. The FileReader contains a buffer of bytes read from the source and
24: * converts these into characters as needed. The buffer size is 8K.
25: *
26: * @see FileWriter
27: */
28: public class FileReader extends InputStreamReader {
29:
30: /**
31: * Construct a new FileReader on the given File <code>file</code>. If the
32: * <code>file</code> specified cannot be found, throw a
33: * FileNotFoundException.
34: *
35: * @param file
36: * a File to be opened for reading characters from.
37: *
38: * @throws FileNotFoundException
39: * if the file cannot be opened for reading.
40: */
41: public FileReader(File file) throws FileNotFoundException {
42: super (new FileInputStream(file));
43: }
44:
45: /**
46: * Construct a new FileReader on the given FileDescriptor <code>fd</code>.
47: * Since a previously opened FileDescriptor is passed as an argument, no
48: * FileNotFoundException is thrown.
49: *
50: * @param fd
51: * the previously opened file descriptor.
52: */
53: public FileReader(FileDescriptor fd) {
54: super (new FileInputStream(fd));
55: }
56:
57: /**
58: * Construct a new FileReader on the given file named <code>filename</code>.
59: * If the <code>filename</code> specified cannot be found, throw a
60: * FileNotFoundException.
61: *
62: * @param filename
63: * an absolute or relative path specifying the file to open.
64: *
65: * @throws FileNotFoundException
66: * if the filename cannot be opened for reading.
67: */
68: public FileReader(String filename) throws FileNotFoundException {
69: super (new FileInputStream(filename));
70: }
71: }
|