AS/400 Toolbox for Java \ Access classes \ Integrated file system \ IFS file output stream

IFSFileOutputStream

The IFSFileOutputStream class represents an output stream for writing data to a file on the AS/400. 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 AS/400. 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.

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();

In addition to the methods in FileOutputStream, IFSFileOutputStream gives the Java program the following options:


[ Information Center Home Page | Feedback ] [ Legal | AS/400 Glossary ]