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
.
HostServerConnection.HostInputStream, HostServerConnection.HostOutputStream
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_FILE_SERVER_PORT |
static int |
DEFAULT_SSL_FILE_SERVER_PORT |
in_, out_
Modifier and Type | Method and Description |
---|---|
int |
closeFile(FileHandle handle) |
int |
deleteFile(java.lang.String filename)
Deletes the specified file.
|
static FileConnection |
getConnection(boolean isSSL,
java.lang.String system,
java.lang.String user,
java.lang.String password) |
static FileConnection |
getConnection(boolean isSSL,
SystemInfo info,
java.lang.String user,
java.lang.String password) |
static FileConnection |
getConnection(boolean isSSL,
SystemInfo info,
java.lang.String user,
java.lang.String password,
int filePort) |
static FileConnection |
getConnection(java.lang.String system,
java.lang.String user,
java.lang.String password) |
static FileConnection |
getConnection(SystemInfo info,
java.lang.String user,
java.lang.String password) |
static FileConnection |
getConnection(SystemInfo info,
java.lang.String user,
java.lang.String password,
int filePort) |
java.util.List<java.lang.String> |
list(java.lang.String dir)
Returns a list of filenames under the specified directory or file spec.
|
java.util.List<FileHandle> |
listFiles(java.lang.String dir)
Returns a list of files under the specified directory or file spec.
|
int |
openFile(java.lang.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(java.lang.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.
|
close, connect, finalize, getBytesReceived, getBytesSent, getEncryptedPassword, getInfo, getJobName, getUser, isClosed, isDatastreamDebug, isDefaultDatastreamDebug, setDatastreamDebug, setDefaultDatastreamDebug, writePadEBCDIC, writePadEBCDIC10, writeStringToUnicodeBytes
public static final int DEFAULT_FILE_SERVER_PORT
public static final int DEFAULT_SSL_FILE_SERVER_PORT
protected void sendEndJobRequest() throws java.io.IOException
sendEndJobRequest
in class HostServerConnection
java.io.IOException
public static FileConnection getConnection(java.lang.String system, java.lang.String user, java.lang.String password) throws java.io.IOException
java.io.IOException
public static FileConnection getConnection(boolean isSSL, java.lang.String system, java.lang.String user, java.lang.String password) throws java.io.IOException
java.io.IOException
public static FileConnection getConnection(SystemInfo info, java.lang.String user, java.lang.String password) throws java.io.IOException
java.io.IOException
public static FileConnection getConnection(boolean isSSL, SystemInfo info, java.lang.String user, java.lang.String password) throws java.io.IOException
java.io.IOException
public static FileConnection getConnection(SystemInfo info, java.lang.String user, java.lang.String password, int filePort) throws java.io.IOException
java.io.IOException
public static FileConnection getConnection(boolean isSSL, SystemInfo info, java.lang.String user, java.lang.String password, int filePort) throws java.io.IOException
java.io.IOException
public java.util.List<FileHandle> listFiles(java.lang.String dir) throws java.io.IOException
java.io.IOException
public java.util.List<java.lang.String> list(java.lang.String dir) throws java.io.IOException
listFiles()
.java.io.IOException
public int deleteFile(java.lang.String filename) throws java.io.IOException
java.io.IOException
public int openFile(java.lang.String filename, FileHandle buffer) throws java.io.IOException
java.io.IOException
public int openFile(java.lang.String filename, FileHandle buffer, int openType, int shareOption, boolean createIfNotExist, int dataCCSID) throws java.io.IOException
java.io.IOException
public int closeFile(FileHandle handle) throws java.io.IOException
java.io.IOException
public int readFile(FileHandle handle, byte[] buffer, int bufferOffset, int bufferLength) throws java.io.IOException
java.io.IOException
public void writeFile(FileHandle handle, byte[] buffer, int bufferOffset, int bufferLength, boolean sync) throws java.io.IOException
java.io.IOException