1. /*
  2. * @(#)FileWriter.java 1.11 00/02/02
  3. *
  4. * Copyright 1996-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package java.io;
  11. /**
  12. * Convenience class for writing character files. The constructors of this
  13. * class assume that the default character encoding and the default byte-buffer
  14. * size are acceptable. To specify these values yourself, construct an
  15. * OutputStreamWriter on a FileOutputStream.
  16. *
  17. * @see OutputStreamWriter
  18. * @see FileOutputStream
  19. *
  20. * @version 1.11, 00/02/02
  21. * @author Mark Reinhold
  22. * @since JDK1.1
  23. */
  24. public class FileWriter extends OutputStreamWriter {
  25. /**
  26. * Constructs a FileWriter object given a file name.
  27. *
  28. * @param fileName String The system-dependent filename.
  29. * @throws IOException if the specified file is not found or if some other
  30. * I/O error occurs.
  31. */
  32. public FileWriter(String fileName) throws IOException {
  33. super(new FileOutputStream(fileName));
  34. }
  35. /**
  36. * Constructs a FileWriter object given a file name with a boolean
  37. * indicating whether or not to append the data written.
  38. *
  39. * @param fileName String The system-dependent filename.
  40. * @param append boolean if <code>true</code>, then data will be written
  41. * to the end of the file rather than the beginning.
  42. * @throws IOException if the specified file is not found or if some other
  43. * I/O error occurs.
  44. */
  45. public FileWriter(String fileName, boolean append) throws IOException {
  46. super(new FileOutputStream(fileName, append));
  47. }
  48. /**
  49. * Constructs a FileWriter object given a File object.
  50. *
  51. * @param file a File object to write to.
  52. * @throws IOException if the specified file is not found or if some other
  53. * I/O error occurs.
  54. */
  55. public FileWriter(File file) throws IOException {
  56. super(new FileOutputStream(file));
  57. }
  58. /**
  59. * Constructs a FileWriter object associated with a file descriptor.
  60. *
  61. * @param fd FileDescriptor object to write to.
  62. */
  63. public FileWriter(FileDescriptor fd) {
  64. super(new FileOutputStream(fd));
  65. }
  66. }