1. /*
  2. * @(#)FileReader.java 1.14 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.io;
  8. /**
  9. * Convenience class for reading character files. The constructors of this
  10. * class assume that the default character encoding and the default byte-buffer
  11. * size are appropriate. To specify these values yourself, construct an
  12. * InputStreamReader on a FileInputStream.
  13. *
  14. * <p><code>FileReader</code> is meant for reading streams of characters.
  15. * For reading streams of raw bytes, consider using a
  16. * <code>FileInputStream</code>.
  17. *
  18. * @see InputStreamReader
  19. * @see FileInputStream
  20. *
  21. * @version 1.14, 03/01/23
  22. * @author Mark Reinhold
  23. * @since JDK1.1
  24. */
  25. public class FileReader extends InputStreamReader {
  26. /**
  27. * Creates a new <tt>FileReader</tt>, given the name of the
  28. * file to read from.
  29. *
  30. * @param fileName the name of the file to read from
  31. * @exception FileNotFoundException if the named file does not exist,
  32. * is a directory rather than a regular file,
  33. * or for some other reason cannot be opened for
  34. * reading.
  35. */
  36. public FileReader(String fileName) throws FileNotFoundException {
  37. super(new FileInputStream(fileName));
  38. }
  39. /**
  40. * Creates a new <tt>FileReader</tt>, given the <tt>File</tt>
  41. * to read from.
  42. *
  43. * @param file the <tt>File</tt> to read from
  44. * @exception FileNotFoundException if the file does not exist,
  45. * is a directory rather than a regular file,
  46. * or for some other reason cannot be opened for
  47. * reading.
  48. */
  49. public FileReader(File file) throws FileNotFoundException {
  50. super(new FileInputStream(file));
  51. }
  52. /**
  53. * Creates a new <tt>FileReader</tt>, given the
  54. * <tt>FileDescriptor</tt> to read from.
  55. *
  56. * @param fd the FileDescriptor to read from
  57. */
  58. public FileReader(FileDescriptor fd) {
  59. super(new FileInputStream(fd));
  60. }
  61. }