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;
}