public class IFSFileOutputStream
extends java.io.OutputStream
implements java.io.Serializable
 // Work with /Dir/File on the system eniac.
 AS400 as400 = new AS400("eniac");
 IFSFileOutputStream file = new IFSFileOutputStream(as400, "/Dir/File");
 // Lock the first 8 bytes of the file.
 IFSKey key = file.lock(8);
 // Write 8 bytes to the file.
 byte[] data = { 0, 1, 2, 3, 4, 5, 6, 7 };
 file.write(data, 0, 8);
 // Unlock the first 8 bytes.
 file.unlock(key);
 // Close the file.
 file.close();
 | Modifier and Type | Field and Description | 
|---|---|
| protected java.beans.PropertyChangeSupport | changes_ | 
| protected IFSFileDescriptor | fd_ | 
| static int | SHARE_ALLShare option that allows read and write access by other users. | 
| static int | SHARE_NONEShare option that does not allow read or write access by other users. | 
| static int | SHARE_READERSShare option that allows only read access by other users. | 
| static int | SHARE_WRITERSShare option that allows only write access by other users. | 
| protected java.beans.VetoableChangeSupport | vetos_ | 
| Constructor and Description | 
|---|
| IFSFileOutputStream()Constructs an IFSFileOutputStream object. | 
| IFSFileOutputStream(AS400 system,
                   IFSFile file,
                   int shareOption,
                   boolean append)Deprecated. 
 Use IFSFileOutputStream(IFSFile, int, boolean) instead. | 
| IFSFileOutputStream(AS400 system,
                   IFSFile file,
                   int shareOption,
                   boolean append,
                   int ccsid)Deprecated. 
 Use IFSFileOutputStream(IFSFile, int, boolean, int) instead. | 
| IFSFileOutputStream(AS400 system,
                   IFSJavaFile file,
                   int shareOption,
                   boolean append)Constructs an IFSFileOutputStream object. | 
| IFSFileOutputStream(AS400 system,
                   IFSJavaFile file,
                   int shareOption,
                   boolean append,
                   int ccsid)Constructs an IFSFileOutputStream object. | 
| IFSFileOutputStream(AS400 system,
                   java.lang.String name)Constructs an IFSFileOutputStream object. | 
| IFSFileOutputStream(AS400 system,
                   java.lang.String name,
                   int ccsid)Constructs an IFSFileOutputStream object. | 
| IFSFileOutputStream(AS400 system,
                   java.lang.String name,
                   int shareOption,
                   boolean append)Constructs an IFSFileOutputStream object. | 
| IFSFileOutputStream(AS400 system,
                   java.lang.String name,
                   int shareOption,
                   boolean append,
                   int ccsid)Constructs an IFSFileOutputStream object. | 
| IFSFileOutputStream(IFSFile file)Constructs an IFSFileOutputStream object. | 
| IFSFileOutputStream(IFSFileDescriptor fd)Creates a file output stream to write to file descriptor fd. | 
| IFSFileOutputStream(IFSFile file,
                   int shareOption,
                   boolean append)Constructs an IFSFileOutputStream object. | 
| IFSFileOutputStream(IFSFile file,
                   int shareOption,
                   boolean append,
                   int ccsid)Constructs an IFSFileOutputStream object. | 
| IFSFileOutputStream(IFSJavaFile file)Constructs an IFSFileOutputStream object. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | addFileListener(FileListener listener)Adds a file listener to receive file events from this IFSFileOutputStream. | 
| void | addPropertyChangeListener(java.beans.PropertyChangeListener listener)Adds a property change listener. | 
| void | addVetoableChangeListener(java.beans.VetoableChangeListener listener)Adds a vetoable change listener. | 
| void | close()Closes this file output stream and releases any system resources associated
   with this stream. | 
| protected void | finalize()Ensures that the file output stream is closed when there are no more
   references to it. | 
| void | flush()Forces any buffered output bytes to be written. | 
| IFSFileDescriptor | getFD()Returns the file descriptor associated with this stream. | 
| java.lang.String | getPath()Returns the integrated file system path name of the object represented by
   this IFSFileOutputStream object. | 
| int | getShareOption()Returns the share option for this object. | 
| AS400 | getSystem()Returns the AS400 system object for this stream. | 
| IFSKey | lock(int length)Deprecated. 
 Replaced by  lock(long) | 
| IFSKey | lock(long length)Places a lock on the file at the current position for the specified number
   of bytes. | 
| protected void | open(int fileDataCCSID)Opens the specified file. | 
| void | removeFileListener(FileListener listener)Removes a file listener so that it no longer receives file events from
   this IFSFileOutputStream. | 
| void | removePropertyChangeListener(java.beans.PropertyChangeListener listener)Removes a property change listener. | 
| void | removeVetoableChangeListener(java.beans.VetoableChangeListener listener)Removes a vetoable change listener. | 
| void | setAppend(boolean append)Sets the append option. | 
| void | setFD(IFSFileDescriptor fd)Sets the file descriptor. | 
| void | setPath(java.lang.String path)Sets the integrated file system path name. | 
| void | setShareOption(int shareOption)Sets the share option. | 
| void | setSystem(AS400 system)Sets the system. | 
| void | unlock(IFSKey key)Undoes a lock on this file. | 
| void | write(byte[] data)Writes data.length bytes of data from the byte array data
   to this file output stream. | 
| void | write(byte[] data,
     int dataOffset,
     int length)Writes length bytes of data from the byte array data, starting
   at offset, to this file output stream. | 
| void | write(int b)Writes the specified byte to this file output stream. | 
public static final int SHARE_ALL
public static final int SHARE_NONE
public static final int SHARE_READERS
public static final int SHARE_WRITERS
protected transient java.beans.PropertyChangeSupport changes_
protected transient java.beans.VetoableChangeSupport vetos_
protected IFSFileDescriptor fd_
public IFSFileOutputStream()
public IFSFileOutputStream(AS400 system, java.lang.String name) throws AS400SecurityException, java.io.IOException
system - The system that contains the file.name - The file to be opened for writing.AS400SecurityException - If a security or authority error occurs.java.io.IOException - If an error occurs while communicating with the system.public IFSFileOutputStream(AS400 system, java.lang.String name, int ccsid) throws AS400SecurityException, java.io.IOException
system - The system that contains the file.name - The file to be opened for writing.ccsid - The CCSID with which to tag the data in the file.AS400SecurityException - If a security or authority error occurs.java.io.IOException - If an error occurs while communicating with the system.public IFSFileOutputStream(AS400 system, java.lang.String name, int shareOption, boolean append) throws AS400SecurityException, java.io.IOException
system - The system that contains the file.name - The file to be opened for writing.shareOption - Indicates how users can access the file. append - Controls the behavior of the file.
   If true, output is appended to the file;
   otherwise, the current contents of the file are erased,
   and output replaces the file contents.AS400SecurityException - If a security or authority error occurs.java.io.IOException - If an error occurs while communicating with the system.public IFSFileOutputStream(AS400 system, java.lang.String name, int shareOption, boolean append, int ccsid) throws AS400SecurityException, java.io.IOException
system - The system that contains the file.name - The file to be opened for writing.shareOption - Indicates how users can access the file. append - Controls the behavior of the file.
   If true, output is appended to the file;
   otherwise, the current contents of the file are erased,
   and output replaces the file contents.ccsid - The CCSID with which to tag the data in the file.AS400SecurityException - If a security or authority error occurs.java.io.IOException - If an error occurs while communicating with the system.public IFSFileOutputStream(IFSFile file) throws AS400SecurityException, java.io.IOException
file - The file to be opened for writing.AS400SecurityException - If a security or authority error occurs.java.io.IOException - If an error occurs while communicating with the system.public IFSFileOutputStream(AS400 system, IFSFile file, int shareOption, boolean append) throws AS400SecurityException, java.io.IOException
system - The system that contains the file.file - The file to be opened for writing.shareOption - Indicates how users can access the file. append - Controls the behavior of the file.
   If true, output is appended to the file;
   otherwise, the current contents of the file are erased,
   and output replaces the file contents.AS400SecurityException - If a security or authority error occurs.java.io.IOException - If an error occurs while communicating with the system.public IFSFileOutputStream(IFSFile file, int shareOption, boolean append) throws AS400SecurityException, java.io.IOException
file - The file to be opened for writing.shareOption - Indicates how users can access the file. append - Controls the behavior of the file.
   If true, output is appended to the file;
   otherwise, the current contents of the file are erased,
   and output replaces the file contents.AS400SecurityException - If a security or authority error occurs.java.io.IOException - If an error occurs while communicating with the system.public IFSFileOutputStream(AS400 system, IFSFile file, int shareOption, boolean append, int ccsid) throws AS400SecurityException, java.io.IOException
system - The system that contains the file.file - The file to be opened for writing.shareOption - Indicates how users can access the file. append - Controls the behavior of the file.
   If true, output is appended to the file;
   otherwise, the current contents of the file are erased,
   and output replaces the file contents.ccsid - The CCSID with which to tag the data in the file.AS400SecurityException - If a security or authority error occurs.java.io.IOException - If an error occurs while communicating with the system.public IFSFileOutputStream(IFSFile file, int shareOption, boolean append, int ccsid) throws AS400SecurityException, java.io.IOException
file - The file to be opened for writing.shareOption - Indicates how users can access the file. append - Controls the behavior of the file.
   If true, output is appended to the file;
   otherwise, the current contents of the file are erased,
   and output replaces the file contents.ccsid - The CCSID with which to tag the data in the file.AS400SecurityException - If a security or authority error occurs.java.io.IOException - If an error occurs while communicating with the system.public IFSFileOutputStream(IFSFileDescriptor fd)
fd - The file descriptor to be opened for writing.public IFSFileOutputStream(IFSJavaFile file) throws AS400SecurityException, java.io.IOException
file - The file to be opened for writing.AS400SecurityException - If a security or authority error occurs.java.io.IOException - If an error occurs while communicating with the system.public IFSFileOutputStream(AS400 system, IFSJavaFile file, int shareOption, boolean append) throws AS400SecurityException, java.io.IOException
system - The system that contains the file.file - The file to be opened for writing.shareOption - Indicates how users can access the file. append - Controls the behavior of the file.
   If true, output is appended to the file;
   otherwise, the current contents of the file are erased,
   and output replaces the file contents.AS400SecurityException - If a security or authority error occurs.java.io.IOException - If an error occurs while communicating with the system.public IFSFileOutputStream(AS400 system, IFSJavaFile file, int shareOption, boolean append, int ccsid) throws AS400SecurityException, java.io.IOException
system - The system that contains the file.file - The file to be opened for writing.shareOption - Indicates how users can access the file. append - Controls the behavior of the file.
   If true, output is appended to the file;
   otherwise, the current contents of the file are erased,
   and output replaces the file contents.ccsid - The CCSID with which to tag the data in the file.AS400SecurityException - If a security or authority error occurs.java.io.IOException - If an error occurs while communicating with the system.public void addFileListener(FileListener listener)
listener - The file listener.public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener - The property change listener to add.public void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
listener - The vetoable change listener to add.public void close()
           throws java.io.IOException
close in interface java.io.Closeableclose in class java.io.OutputStreamjava.io.IOException - If an error occurs while communicating with the system.protected void finalize()
                 throws java.io.IOException
finalize in class java.lang.Objectjava.io.IOException - If an error occurs while communicating with the system.public void flush()
           throws java.io.IOException
flush in interface java.io.Flushableflush in class java.io.OutputStreamjava.io.IOException - If an error occurs while communicating with the system.public final IFSFileDescriptor getFD() throws java.io.IOException
java.io.IOException - If an error occurs while communicating with the system.public java.lang.String getPath()
public int getShareOption()
public AS400 getSystem()
public IFSKey lock(int length) throws java.io.IOException
lock(long)length - The number of bytes to lock.ExtendedIOException - If the specified bytes are already locked by another process.java.io.IOException - If an error occurs while communicating with the system.unlock(com.ibm.as400.access.IFSKey)public IFSKey lock(long length) throws java.io.IOException
length - The number of bytes to lock.java.io.IOException - If an error occurs while communicating with the system.unlock(com.ibm.as400.access.IFSKey)protected void open(int fileDataCCSID)
             throws java.io.IOException
fileDataCCSID - The CCSID with which to tag the data in the file.java.io.IOException - If an error occurs while communicating with the system.public void removeFileListener(FileListener listener)
listener - The file listener.public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener - The property change listener to remove.public void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
listener - The vetoable change listener to remove.public void setAppend(boolean append)
               throws java.beans.PropertyVetoException
append - If true, data is appended to an existing file;
   otherwise, output replaces the file contents.java.beans.PropertyVetoException - If the change is vetoed.public void setFD(IFSFileDescriptor fd) throws java.beans.PropertyVetoException
fd - The file descriptor.java.beans.PropertyVetoException - If the change is vetoed.public void setPath(java.lang.String path)
             throws java.beans.PropertyVetoException
path - The absolute integrated file system path name.java.beans.PropertyVetoException - If the change is vetoed.public void setShareOption(int shareOption)
                    throws java.beans.PropertyVetoException
shareOption - Indicates how users can access the file. java.beans.PropertyVetoException - If the change is vetoed.public void setSystem(AS400 system) throws java.beans.PropertyVetoException
system - The system object.java.beans.PropertyVetoException - If the change is vetoed.public void unlock(IFSKey key) throws java.io.IOException
key - The key for the lock.java.io.IOException - If an error occurs while communicating with the system.IFSKey, 
lock(long)public void write(int b)
           throws java.io.IOException
write in class java.io.OutputStreamb - The byte to be written.java.io.IOException - If an error occurs while communicating with the system.public void write(byte[] data)
           throws java.io.IOException
write in class java.io.OutputStreamdata - The data to be written.java.io.IOException - If an error occurs while communicating with the system.public void write(byte[] data,
         int dataOffset,
         int length)
           throws java.io.IOException
write in class java.io.OutputStreamdata - The data to be written.dataOffset - The start offset in the data.length - The number of bytes to write.java.io.IOException - If an error occurs while communicating with the system.