The IFSFileOutputStream class represents an output stream for writing data to a file on the server.
As in the IFSFile class, methods exist in IFSFileOutputStream that duplicate the methods in FileOutputStream from the java.io package. IFSFileOutputStream also has additional methods specific to the server. The IFSFileOutputStream class allows a Java™ program to do the following:
As in FileOutputStream in java.io, this class allows a Java program to sequentially write a stream of bytes to the file.
In addition to the methods in FileOutputStream, IFSFileOutputStream gives the Java program the following options:
The following example shows how to use the IFSFileOutputStream class:
// Create an AS400 object AS400 sys = new AS400("mySystem.myCompany.com"); // Open a file object that // represents the file. IFSFileOutputStream aFile = new IFSFileOutputStream(sys,"/mydir1/mydir2/myfile"); // Write to the file byte i = 123; aFile.write(i); // Close the file. aFile.close();