com.ibm.jtopenlite.file
Class FileConnection

java.lang.Object
  extended by com.ibm.jtopenlite.HostServerConnection
      extended by com.ibm.jtopenlite.file.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).


Nested Class Summary
 
Nested classes/interfaces inherited from class com.ibm.jtopenlite.HostServerConnection
HostServerConnection.HostInputStream, HostServerConnection.HostOutputStream
 
Field Summary
static int DEFAULT_FILE_SERVER_PORT
           
 
Fields inherited from class com.ibm.jtopenlite.HostServerConnection
in_, out_
 
Method Summary
 int closeFile(FileHandle handle)
           
 int deleteFile(String filename)
          Deletes the specified file.
static FileConnection getConnection(String system, String user, String password)
           
static FileConnection getConnection(SystemInfo info, String user, String password)
           
static FileConnection getConnection(SystemInfo info, String user, String password, int filePort)
           
 int openFile(String filename, FileHandle buffer)
          Opens a file for read-write access, a share option of SHARE_ALL, and a data CCSID of 1208 (UTF-8).
 int openFile(String filename, FileHandle buffer, int openType, int shareOption, boolean createIfNotExist, int dataCCSID)
           
 int readFile(FileHandle handle, byte[] buffer, int bufferOffset, int bufferLength)
           
protected  void sendEndJobRequest()
           
 void writeFile(FileHandle handle, byte[] buffer, int bufferOffset, int bufferLength, boolean sync)
          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.
 
Methods inherited from class com.ibm.jtopenlite.HostServerConnection
close, connect, finalize, getEncryptedPassword, getInfo, getJobName, getUser, isClosed, isDatastreamDebug, isDefaultDatastreamDebug, setDatastreamDebug, writePadEBCDIC, writePadEBCDIC10, writeStringToUnicodeBytes
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_FILE_SERVER_PORT

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

sendEndJobRequest

protected void sendEndJobRequest()
                          throws IOException
Specified by:
sendEndJobRequest in class HostServerConnection
Throws:
IOException

getConnection

public static FileConnection getConnection(String system,
                                           String user,
                                           String password)
                                    throws IOException
Throws:
IOException

getConnection

public static FileConnection getConnection(SystemInfo info,
                                           String user,
                                           String password)
                                    throws IOException
Throws:
IOException

getConnection

public static FileConnection getConnection(SystemInfo info,
                                           String user,
                                           String password,
                                           int filePort)
                                    throws IOException
Throws:
IOException

deleteFile

public int deleteFile(String filename)
               throws IOException
Deletes the specified file.

Throws:
IOException

openFile

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

Throws:
IOException

openFile

public int openFile(String filename,
                    FileHandle buffer,
                    int openType,
                    int shareOption,
                    boolean createIfNotExist,
                    int dataCCSID)
             throws IOException
Throws:
IOException

closeFile

public int closeFile(FileHandle handle)
              throws IOException
Throws:
IOException

readFile

public int readFile(FileHandle handle,
                    byte[] buffer,
                    int bufferOffset,
                    int bufferLength)
             throws IOException
Throws:
IOException

writeFile

public void writeFile(FileHandle handle,
                      byte[] buffer,
                      int bufferOffset,
                      int bufferLength,
                      boolean sync)
               throws 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:
IOException