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

Integrated file system

The integrated file system classes allow a Java program to access files in the AS/400 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 AS/400 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 to these methods, the classes contain methods to do the following:

Through the integrated file system classes, the Java program can directly access stream files on the AS/400. 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 AS/400 Client Access for 32-bit Windows is required to redirect java.io calls to the AS/400. With the integrated file system classes, you do not need Client Access for AS/400.

A required parameter of the integrated file system classes is the AS400 object that represents the AS/400 system that contains the file. Using the integrated file system classes causes the AS400 object to connect to the AS/400. 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

The integrated file system classes are as follows.

Class Description
IFSFile Represents a file in the integrated file system
IFSJavaFile Represents a file in the integrated file system (extends java.io.File)
IFSFileInputStream Represents an input stream for reading data from an AS/400 file
IFSTextFileInputStream Represents a stream of character data read from a file
IFSFileOutputStream Represents an output stream for writing data to an AS/400 file
IFSTextFileOutputStream Represents a stream of character data being written to a file
IFSRandomAccessFile Represents a file on the AS/400 for reading and writing data
IFSFileDialog Allows the user to move within the file system and to select a file within the file system

Examples

The IFSCopyFile example shows how to use the integrated file system classes to copy a file from one directory to another on the AS/400.

The File List Example shows how to use the integrated file system classes to list the contents of a directory on the AS/400.


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