The integrated file system classes allow a Java™ program to access files in the IBM® i integrated file system as a stream of bytes or a stream of characters. The integrated file system classes were created because the java.io package does not provide file redirection and other IBM i functionality.
The function that is provided by the IFSFile classes is a superset of the function provided by the file IO classes in the java.io package. All methods in java.io FileInputStream, FileOutputStream, and RandomAccessFile are in the integrated file system classes.
In addition, the classes contain methods to do the following:
Through the integrated file system classes, the Java program can directly access stream files on the system. The Java program can still use the java.io package, but the client operating system must then provide a method of redirection. For example, if the Java program is running on a Windows® 95 or Windows NT® operating system, the Network Drives function of IBM i Access for Windows is required to redirect java.io calls to the system. With the integrated file system classes, you do not need IBM i Access for Windows.
A required parameter of the integrated file system classes is the AS400 object that represents the system that contains the file. Using the integrated file system classes causes the AS400 object to connect to the system. See managing connections for information about managing connections.
The integrated file system classes require the hierarchical name of the object in the integrated file system. Use the forward slash as the path separator character. The following example shows how to access FILE1 in directory path DIR1/DIR2:
/DIR1/DIR2/FILE1
Examples: Using integrated file system classes
Example: Using IFS classes to copy a file from one directory to another shows how to use the integrated file system classes to copy a file from one directory to another on the system.
Example: Using the IFS classes to list the contents of a directory shows how to use the integrated file system classes to list the contents of a directory on the system.