Class java.io.FileOutputStream
All Packages    This Package    Previous    Next

Class java.io.FileOutputStream

java.lang.Object
   |
   +----java.io.OutputStream
           |
           +----java.io.FileOutputStream

public class FileOutputStream
extends OutputStream
File output stream; can be constructed from a file descriptor or a file name.
See Also:
FileInputStream, File
Version:
1.11, 17 Feb 1995
Author:
Arthur van Hoff

FileOutputStream(String)
Creates an output file given a file name.
FileOutputStream(int)
Creates an output file given a file descriptor.
FileOutputStream(File)
Creates an output file given a File object.

close()
Closes the stream.
finalize()
Close the stream when garbage is collected.
getFD()
Returns the file descriptor associated with this stream.
write(int)
Write a byte.
write(byte[])
Writes an array of bytes.
write(byte[], int, int)
Writes a sub array of bytes.

FileOutputStream
  public FileOutputStream(String name)
Creates an output file given a file name.
Parameters:
name - the file name (very system dependent)
Throws: IOException
i/o error occurred, file not found

FileOutputStream

  public FileOutputStream(int fd)
Creates an output file given a file descriptor.
Parameters:
fd - the file descriptor (very system dependent)
Throws: IOException
i/o error occurred

FileOutputStream

  public FileOutputStream(File file)
Creates an output file given a File object.
Parameters:
file - the file to be opened for reading
Throws: IOException
i/o error occurred, file not found

write
  public void write(int b)
Write a byte. Will block until the byte is actually written.
Throws: IOException
i/o error occurred
Overrides:
write in class OutputStream

write

  public void write(byte b[])
Writes an array of bytes. Will block until the bytes are actually written.
Parameters:
b - the data to be written
Throws: IOException
i/o error occurred
Overrides:
write in class OutputStream

write

  public void write(byte b[],
                    int off,
                    int len)
Writes a sub array of bytes. To be efficient it should be overridden in a subclass.
Parameters:
b - the data to be written
off - the start offset in the data
len - the number of bytes that are written
Throws: IOException
i/o error occurred
Overrides:
write in class OutputStream

close

  public synchronized void close()
Closes the stream. This method must be called to release any resources associated with the stream.
Throws: IOException
i/o error occurred
Overrides:
close in class OutputStream

getFD

  public final int getFD()
Returns the file descriptor associated with this stream.

finalize

  protected void finalize()
Close the stream when garbage is collected.


All Packages    This Package    Previous    Next