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

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

Constructor Index

 o FileOutputStream(File)
Creates an output file with the specified File object.
 o FileOutputStream(FileDescriptor)
 o FileOutputStream(String)
Creates an output file with the specified system dependent file name.

Method Index

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

Constructors

 o FileOutputStream
  public FileOutputStream(String name) throws IOException
Creates an output file with the specified system dependent file name.
Parameters:
name - the system dependent file name
Throws: IOException
If the file is not found.
 o FileOutputStream
  public FileOutputStream(File file) throws IOException
Creates an output file with the specified File object.
Parameters:
file - the file to be opened for reading
Throws: IOException
If the file is not found.
 o FileOutputStream
  public FileOutputStream(FileDescriptor fdObj)

Methods

 o write
  public void write(int b) throws IOException
Writes a byte of data. This method will block until the byte is actually written.
Parameters:
b - the byte to be written
Throws: IOException
If an I/O error has occurred.
Overrides:
write in class OutputStream
 o write
  public void write(byte b[]) throws IOException
Writes an array of bytes. Will block until the bytes are actually written.
Parameters:
b - the data to be written
Throws: IOException
If an I/O error has occurred.
Overrides:
write in class OutputStream
 o write
  public void write(byte b[],
                    int off,
                    int len) throws IOException
Writes a sub array of bytes.
Parameters:
b - the data to be written
off - the start offset in the data
len - the number of bytes that are written
Throws: IOException
If an I/O error has occurred.
Overrides:
write in class OutputStream
 o close
  public void close() throws IOException
Closes the stream. This method must be called to release any resources associated with the stream.
Throws: IOException
If an I/O error has occurred.
Overrides:
close in class OutputStream
 o getFD
  public final FileDescriptor getFD() throws IOException
Returns the file descriptor associated with this stream.
Returns:
the file descriptor.
 o finalize
  protected void finalize() throws IOException
Closes the stream when garbage is collected.
Overrides:
finalize in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index