FileOutputStream


FileOutputStream java.io

Java 1.0 closeable flushable

This class is a subclass of OutputStream that writes data to a file specified by name or by a File or FileDescriptor object. If the specified file already exists, a FileOutputStream can be configured to overwrite or append to the existing file. write( ) writes a byte or array of bytes to the file. To write binary data, you typically use this class in conjunction with a BufferedOutputStream and a DataOutputStream . To write text, you typically use it with a PrintWriter , BufferedWriter and an OutputStreamWriter (or you use the convenience class FileWriter ). Use close( ) to close a FileOutputStream when no further output will be written to it.

In Java 1.4 and later, use getChannel( ) to obtain a FileChannel object for writing to the underlying file using the New I/O API of java.nio and its subpackages.

Figure 9-17. java.io.FileOutputStream

 public class  FileOutputStream  extends OutputStream {  // Public Constructors  public  FileOutputStream  (FileDescriptor  fdObj  );        public  FileOutputStream  (File  file  ) throws FileNotFoundException;        public  FileOutputStream  (String  name  ) throws FileNotFoundException;  1.1  public  FileOutputStream  (String  name  , boolean  append  ) throws FileNotFoundException;  1.4  public  FileOutputStream  (File  file  , boolean  append  ) throws FileNotFoundException;  // Public Instance Methods   1.4  public java.nio.channels.FileChannel  getChannel  ( );        public final FileDescriptor  getFD  ( ) throws IOException;  // Public Methods Overriding OutputStream  public void  close  ( ) throws IOException;        public void  write  (int  b  ) throws IOException;  native  public void  write  (byte[ ]  b  ) throws IOException;        public void  write  (byte[ ]  b  , int  off  , int  len  ) throws IOException;  // Protected Methods Overriding Object  protected void  finalize  ( ) 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