com.ibm.jtopenlite.file

Class FileConnection

  • All Implemented Interfaces:
    Connection


    public class FileConnection
    extends HostServerConnection

    Represents a TCP/IP socket connection to the System i File host server (QSERVER/QPWFSERVSO prestart jobs).

    For an example, see AccessIfsFile.

    • Field Detail

      • DEFAULT_FILE_SERVER_PORT

        public static final int DEFAULT_FILE_SERVER_PORT
        See Also:
        Constant Field Values
      • DEFAULT_SSL_FILE_SERVER_PORT

        public static final int DEFAULT_SSL_FILE_SERVER_PORT
        See Also:
        Constant Field Values
    • Method Detail

      • getConnection

        public static FileConnection getConnection(java.lang.String system,
                                   java.lang.String user,
                                   java.lang.String password)
                                            throws java.io.IOException
        Throws:
        java.io.IOException
      • getConnection

        public static FileConnection getConnection(boolean isSSL,
                                   java.lang.String system,
                                   java.lang.String user,
                                   java.lang.String password)
                                            throws java.io.IOException
        Throws:
        java.io.IOException
      • getConnection

        public static FileConnection getConnection(SystemInfo info,
                                   java.lang.String user,
                                   java.lang.String password)
                                            throws java.io.IOException
        Throws:
        java.io.IOException
      • getConnection

        public static FileConnection getConnection(boolean isSSL,
                                   SystemInfo info,
                                   java.lang.String user,
                                   java.lang.String password)
                                            throws java.io.IOException
        Throws:
        java.io.IOException
      • getConnection

        public static FileConnection getConnection(SystemInfo info,
                                   java.lang.String user,
                                   java.lang.String password,
                                   int filePort)
                                            throws java.io.IOException
        Throws:
        java.io.IOException
      • getConnection

        public static FileConnection getConnection(boolean isSSL,
                                   SystemInfo info,
                                   java.lang.String user,
                                   java.lang.String password,
                                   int filePort)
                                            throws java.io.IOException
        Throws:
        java.io.IOException
      • listFiles

        public java.util.List<FileHandle> listFiles(java.lang.String dir)
                                             throws java.io.IOException
        Returns a list of files under the specified directory or file spec. For example, these all return the same file listing:
        • list("/home/smith")
        • list("/home/smith/*")
        • list("/home/smith/../smith")
        Throws:
        java.io.IOException
      • list

        public java.util.List<java.lang.String> list(java.lang.String dir)
                                              throws java.io.IOException
        Returns a list of filenames under the specified directory or file spec. For example, these all return the same file listing:
        • list("/home/smith")
        • list("/home/smith/*")
        • list("/home/smith/../smith")
        To return more than just the names of files, use listFiles().
        Throws:
        java.io.IOException
      • deleteFile

        public int deleteFile(java.lang.String filename)
                       throws java.io.IOException
        Deletes the specified file.
        Throws:
        java.io.IOException
      • openFile

        public int openFile(java.lang.String filename,
                   FileHandle buffer)
                     throws java.io.IOException
        Opens a file for read-write access, a share option of SHARE_ALL, and a data CCSID of 1208 (UTF-8).
        Throws:
        java.io.IOException
      • openFile

        public int openFile(java.lang.String filename,
                   FileHandle buffer,
                   int openType,
                   int shareOption,
                   boolean createIfNotExist,
                   int dataCCSID)
                     throws java.io.IOException
        Throws:
        java.io.IOException
      • closeFile

        public int closeFile(FileHandle handle)
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • readFile

        public int readFile(FileHandle handle,
                   byte[] buffer,
                   int bufferOffset,
                   int bufferLength)
                     throws java.io.IOException
        Throws:
        java.io.IOException
      • writeFile

        public void writeFile(FileHandle handle,
                     byte[] buffer,
                     int bufferOffset,
                     int bufferLength,
                     boolean sync)
                       throws java.io.IOException
        Writes data to the file starting at the current file offset in the handle, and optionally sync-ing the data to disk; upon a successful write, the current file offset and size are incremented.
        Throws:
        java.io.IOException