Writing data to Files

The java.io.FileOutputStream class represents an OutputStream that writes bytes to a file. It has the following public methods:

 public FileOutputStream(String name) throws IOException
 public FileOutputStream(String name, boolean append) throws IOException
 public FileOutputStream(File file) throws IOException
 public FileOutputStream(FileDescriptor fdObj)
 public native void write(int b) throws IOException
 public void write(byte[] data) throws IOException
 public void write(byte[] data, int offset, int length) throws IOException
 public native void close() throws IOException
 public final FileDescriptor getFD() throws IOException
Except for the constructors and getFD(), these methods merely override the methods of the same name in java.io.OutputStream. You use them exactly like you use those methods, only the output is written into a file.


Previous | Next | Top
Last Modified November 19, 1999
Copyright 1997, 1999 Elliotte Rusty Harold
elharo@metalab.unc.edu