JAFS API v2

org.openafs.jafs
Class FileOutputStream

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--org.openafs.jafs.FileOutputStream

public class FileOutputStream
extends OutputStream

This class is a file output stream for files within AFS. It is an output stream for writing data to a File.

Version:
2.1, 08/03/2001
See Also:
File, FileInputStream, FileOutputStream

Constructor Summary
FileOutputStream(File file)
          Creates a file output stream to write to the AFS file represented by the specified File object.
FileOutputStream(File file, boolean append)
          Creates a file output stream to write to the AFS file represented by the specified File object.
FileOutputStream(String name)
          Creates an output file stream to write to the AFS file with the specified name.
FileOutputStream(String name, boolean append)
          Creates an output file stream to write to the AFS file with the specified name.
 
Method Summary
 void close()
          Closes this file output stream and releases any system resources associated with this stream.
 void write(byte[] b)
          Writes b.length bytes from the specified byte array to this file output stream.
 void write(byte[] b, int off, int len)
          Writes len bytes from the specified byte array starting at offset off to this file output stream.
 void write(int b)
          Writes the specified byte to this file output stream.
 
Methods inherited from class java.io.OutputStream
flush
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileOutputStream

public FileOutputStream(String name)
                 throws AFSFileException
Creates an output file stream to write to the AFS file with the specified name.

If the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason then a AFSFileException is thrown.

Parameters:
name - the name of the file to write to
Throws:
AFSFileException - If an AFS specific error occurs, if the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason, including authorization.

FileOutputStream

public FileOutputStream(String name,
                        boolean append)
                 throws AFSFileException
Creates an output file stream to write to the AFS file with the specified name. If the second argument is true, then bytes will be written to the end of the file rather than the beginning.

If the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason then a AFSFileException is thrown.

Parameters:
name - the name of the file to write to
append - if true, then bytes will be written to the end of the file rather than the beginning
Throws:
AFSFileException - If an AFS specific error occurs, if the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason, including authorization.

FileOutputStream

public FileOutputStream(File file)
                 throws AFSFileException
Creates a file output stream to write to the AFS file represented by the specified File object.

If the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason then a AFSFileException is thrown.

Parameters:
file - the AFS file to be opened for writing.
Throws:
AFSFileException - If an AFS specific error occurs, if the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason, including authorization.
See Also:
File.getPath()

FileOutputStream

public FileOutputStream(File file,
                        boolean append)
                 throws AFSFileException
Creates a file output stream to write to the AFS file represented by the specified File object.

If the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason then a AFSFileException is thrown.

Parameters:
file - the AFS file to be opened for writing.
append - if true, then bytes will be written to the end of the file rather than the beginning
Throws:
AFSFileException - If an AFS specific error occurs, if the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason, including authorization.
See Also:
File.getPath()
Method Detail

write

public void write(int b)
           throws AFSFileException
Writes the specified byte to this file output stream.

Implements the abstract write method of OutputStream.

Specified by:
write in class OutputStream
Parameters:
b - the byte to be written.
Throws:
AFSFileException - if an error occurs.

write

public void write(byte[] b)
           throws AFSFileException
Writes b.length bytes from the specified byte array to this file output stream.

Implements the write method of three arguments with the arguments b, 0, and b.length.

Note that this method does not call the one-argument write method of its underlying stream with the single argument b.

Overrides:
write in class OutputStream
Parameters:
b - the data to be written.
Throws:
AFSFileException - if an error occurs.
See Also:
write(byte[], int, int), FilterOutputStream.write(byte[], int, int)

write

public void write(byte[] b,
                  int off,
                  int len)
           throws AFSFileException
Writes len bytes from the specified byte array starting at offset off to this file output stream.

Overrides:
write in class OutputStream
Parameters:
b - the data to be written
off - the start offset in the data
len - the number of bytes that are written
Throws:
AFSFileException - if an I/O or other file related error occurs.
See Also:
FilterOutputStream.write(int)

close

public void close()
           throws AFSFileException
Closes this file output stream and releases any system resources associated with this stream. This file output stream may no longer be used for writing bytes.

Overrides:
close in class OutputStream
Throws:
AFSFileException - if an I/O or other file related error occurs.

JAFS API v2