IFSTextFileOutputStream class

IFSTextFileOutputStream has been deprecated and replaced by class IFSFileWriter.

The IFSTextFileOutputStream class represents a stream of character data being written to a file. The data supplied to the IFSTextFileOutputStream object is in a Java™ String object so the input is always Unicode. The IFSTextFileOutputStream object can convert the data to another CCSID as it is written to the file, however. The default behavior is to write Unicode characters to the file, but the Java program can set the target CCSID before the file is opened. In this case, the IFSTextFileOutputStream object converts the characters from Unicode to the specified CCSID before writing them to the file. If the data cannot be converted, an UnsupportedEncodingException is thrown.

Example: Using IFSTextFileOutputStream

The following example shows how to use IFSTextFileOutputStream:

                       // Work with /File on the system
                       // mySystem.
     AS400 as400 = new AS400("mySystem");
     IFSTextFileOutputStream file = new IFSTextFileOutputStream(as400, "/File");

                       // Write a String to the file.
                       // Because no CCSID was specified
                       // before writing to the file,
                       // Unicode characters will be
                       // written to the file. The file
                       // will be tagged as having Unicode
                       // data.
     file.write("Hello world");

                       // Close the file.
     file.close();
Related reference
IFSFileWriter