java.io
Class FileOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FileOutputStream

public class FileOutputStream
extends OutputStream

Writes a stream of bytes to a file.

Author:
Brian Bagnall

Constructor Summary
FileOutputStream(File f)
          create a new OutputStream to write to this file, starting at the beginning of the file.
FileOutputStream(File f, boolean append)
          create a new OutputStream to write to this file
 
Method Summary
 void close()
          Write the buffer to flash memory and update the file parameters in flash.
 void flush()
          Flushes this output stream and forces any buffered output bytes to be written out.
 void write(int b)
          write 1 byte to the file; if necessary, file will be moved become the last file in memory
 
Methods inherited from class java.io.OutputStream
write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileOutputStream

public FileOutputStream(File f)
create a new OutputStream to write to this file, starting at the beginning of the file.

Parameters:
f - the file this stream writes to

FileOutputStream

public FileOutputStream(File f,
                        boolean append)
create a new OutputStream to write to this file

Parameters:
f - the file this stream writes to
append - if true this stream will start writing at the end of the file, otherwise at the beginning
Method Detail

write

public void write(int b)
           throws IOException
write 1 byte to the file; if necessary, file will be moved become the last file in memory

Specified by:
write in class OutputStream
Parameters:
b - the byte.
Throws:
IOException - if an I/O error occurs. In particular, an IOException may be thrown if the output stream has been closed.

flush

public void flush()
           throws IOException
Description copied from class: OutputStream
Flushes this output stream and forces any buffered output bytes to be written out. The general contract of flush is that calling it is an indication that, if any bytes previously written have been buffered by the implementation of the output stream, such bytes should immediately be written to their intended destination.

The flush method of OutputStream does nothing.

Overrides:
flush in class OutputStream
Throws:
IOException - if an I/O error occurs.

close

public void close()
           throws IOException
Write the buffer to flash memory and update the file parameters in flash. Resets pointers, so file can be written again from beginning with the same output stream.

Overrides:
close in class OutputStream
Throws:
IOException - if an I/O error occurs.