FileWriter


FileWriter java.io

Java 1.1 appendable closeable flushable

FileWriter is a convenience subclass of OutputStreamWriter that is useful when you want to write text (as opposed to binary data) to a file. You create a FileWriter by specifying the file to be written to and, optionally , whether the data should be appended to the end of an existing file instead of overwriting that file. The FileWriter class creates an internal FileOutputStream to write bytes to the specified file and uses the functionality of its superclass, OutputStreamWriter , to convert the Unicode characters written to the stream into bytes using the default encoding of the default locale. (If you want to use an encoding other than the default, you cannot use FileWriter ; in that case you must create your own OutputStreamWriter and FileOutputStream .) Because FileWriter is a trivial subclass of OutputStreamWriter , it does not define any methods of its own, but simply inherits them from its superclass.

Figure 9-20. java.io.FileWriter

 public class  FileWriter  extends OutputStreamWriter {  // Public Constructors  public  FileWriter  (File  file  ) throws IOException;        public  FileWriter  (FileDescriptor  fd  );        public  FileWriter  (String  fileName  ) throws IOException;  1.4  public  FileWriter  (File  file  , boolean  append  ) throws IOException;        public  FileWriter  (String  fileName  , boolean  append  ) throws IOException;   } 



Java In A Nutshell
Java In A Nutshell, 5th Edition
ISBN: 0596007736
EAN: 2147483647
Year: 2004
Pages: 1220

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net