head 1.1; branch 1.1.1; access ; symbols DEVEL:1.1.1.1 HEAD:1.1.1; locks ; strict; comment @# @; 1.1 date 2001.03.16.18.13.14; author jallali; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2001.03.16.18.13.14; author jallali; state Exp; branches ; next ; desc @@ 1.1 log @Initial revision @ text @

Overview | Package | Class | Tree | Deprecated | Index | Help
| EJCL Xtreme for PalmOS
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## java.io
Class FileOutputStream

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

public class FileOutputStream
extends OutputStream

FileOutputStream is a class whose underlying stream is represented by a file in the operating system. The bytes that are written to this stream are passed directly to the underlying operating system equivalent function. Since overhead may be high in writing to the OS, FileOutputStreams are usually wrapped with a BufferedOutputStream to reduce the number of times the OS is called.

`BufferedOutputStream buf = new BufferedOutputStream(new FileOutputStream("aFile.txt"));`

See Also:
  `FileInputStream`

Constructor Summary
`FileOutputStream(File file)` Constructs a new FileOutputStream on the File `file`.
`FileOutputStream(FileDescriptor fd)` Constructs a new FileOutputStream on the FileDescriptor `fd`.
`FileOutputStream(String filename)` Constructs a new FileOutputStream on the file named `fileName`.
`FileOutputStream(String filename, boolean append)` Constructs a new FileOutputStream on the file named `filename`.

Method Summary
`void` | `close()` Close the FileOutputStream.
`protected void` | `finalize()` Frees any resources allocated to represent this FileOutputStream before it is garbage collected.
`FileDescriptor` | `getFD()` Answers a FileDescriptor which represents the lowest level representation of a OS stream resource.
`void` | `write(byte[] buffer, int offset, int count)` Writes `count` `bytes` from the byte array `buffer` starting at `offset` to this FileOutputStream.
`void` | `write(int oneByte)` Writes the specified byte `oneByte` to this FileOutputStream.

Methods inherited from class java.io.OutputStream
`flush, write`

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### FileOutputStream

    public FileOutputStream(File file)
                     throws IOException

  Constructs a new FileOutputStream on the File `file`. If the file exists, it is written over. See the constructor which can append to the file if so desired.
  Parameters:
    `file` - the File on which to stream reads.
  Throws:
    IOException - If the `file` cannot be opened for writing.
  See Also:
    `java.lang.SecurityManager#checkWrite()`

### FileOutputStream

    public FileOutputStream(FileDescriptor fd)

  Constructs a new FileOutputStream on the FileDescriptor `fd`. The file must already be open, therefore no `FileIOException` will be thrown.
  Parameters:
    `fd` - the FileDescriptor on which to stream writes.
  See Also:
    `java.lang.SecurityManager#checkWrite()`

### FileOutputStream

    public FileOutputStream(String filename)
                     throws FileNotFoundException

  Constructs a new FileOutputStream on the file named `fileName`. If the file exists, it is written over. See the constructor which can append to the file if so desired. The `fileName` may be absolute or relative to the System property `"user.dir"`.
  Parameters:
    `fileName` - the file on which to stream writes.
  Throws:
    FileNotFoundException - If the `filename` cannot be opened for writing.

### FileOutputStream

    public FileOutputStream(String filename,
                            boolean append)
                     throws FileNotFoundException

  Constructs a new FileOutputStream on the file named `filename`. If the file exists, it is written over. See the constructor which can append to the file if so desired. The `filename` may be absolute or relative to the System property `"user.dir"`.
  Parameters:
    `filename` - the file on which to stream writes.
    `append` - a boolean indicating whether or not to append to an existing file.
  Throws:
    FileNotFoundException - If the `filename` cannot be opened for writing.

Method Detail

### close

    public void close()
               throws IOException

  Close the FileOutputStream. This implementation closes the underlying OS resources allocated to represent this stream.
  Overrides:
    close in class OutputStream
  Throws:
    IOException - If an error occurs attempting to close this FileOutputStream.

### finalize

    protected void finalize()
                     throws IOException

  Frees any resources allocated to represent this FileOutputStream before it is garbage collected. This method is called from the Java Virtual Machine.
  Throws:
    IOException - If an error occurs attempting to finalize this FileOutputStream.

### getFD

    public final FileDescriptor getFD()
                               throws IOException

  Answers a FileDescriptor which represents the lowest level representation of a OS stream resource.
  Returns:
    a FileDescriptor representing this FileOutputStream.
  Throws:
    IOException - If the Stream is already closed and there is no FileDescriptor.

### write

    public void write(byte[] buffer,
                      int offset,
                      int count)
               throws IOException

  Writes `count` `bytes` from the byte array `buffer` starting at `offset` to this FileOutputStream.
  Overrides:
    write in class OutputStream
  Parameters:
    `buffer` - the buffer to be written
    `offset` - offset in buffer to get bytes
    `count` - number of bytes in buffer to write
  Throws:
    IOException - If an error occurs attempting to write to this FileOutputStream.
    IndexOutOfBoundsException - If offset or count are outside of bounds.
    NullPointerException - If buffer is `null`.

### write

    public void write(int oneByte)
               throws IOException

  Writes the specified byte `oneByte` to this FileOutputStream. Only the low order byte of `oneByte` is written.
  Overrides:
    write in class OutputStream
  Parameters:
    `oneByte` - the byte to be written
  Throws:
    IOException - If an error occurs attempting to write to this FileOutputStream.

Overview | Package | Class | Tree | Deprecated | Index | Help
| EJCL Xtreme for PalmOS
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

@ 1.1.1.1 log @import initial @ text @@