public class UFTPSessionClient extends AbstractUFTPClient
| Constructor and Description |
|---|
UFTPSessionClient(InetAddress[] servers,
int port)
create a new UFTP session client
|
| Modifier and Type | Method and Description |
|---|---|
void |
cd(String dir)
change to the given remote directory
|
void |
cdUp()
change to the parent directory
|
static UFTPSessionClient |
create(String[] args)
create a session client instance from the supplied commandline parameters
|
void |
disconnect()
end the session
|
void |
get(String remoteFile,
long offset,
long length,
OutputStream localTarget)
partial read: get a chunk of a remote file
|
void |
get(String remoteFile,
OutputStream localTarget)
get the remote file and write it to the given local stream
|
File |
getBaseDirectory() |
List<FileInfo> |
getFileInfoList(String baseDir)
get file information for the given basedir (which is relative to the
current dir)
|
List<String> |
getFileList(String baseDir)
get the raw result of 'ls' for the given basedir (which is relative to
the current dir)
|
long |
getFileSize(String pathName) |
static String |
makeCommandline(String host,
int port,
String baseDirectory,
String secret,
int numStreams,
String encryptionKey,
int bufferSize,
boolean compress,
String commandFile)
create a correct commandline for passing the given parameters to a
UFTPSessionClient
|
void |
mkdir(String dir)
create a remote directory
|
void |
put(String remoteFile,
long size,
InputStream localSource)
write data to a remote file
|
void |
put(String remoteFile,
long size,
long offset,
InputStream localSource)
write data to a remote file
|
String |
pwd()
get the current directory
|
void |
rename(String from,
String to)
rename / move a remote file/directory
|
void |
rm(String path)
delete a remote file/directory
|
void |
run() |
void |
setBaseDirectory(File base)
set the local base directory
|
void |
setCommandFile(String commandFile) |
void |
setModificationTime(String path,
Calendar to)
set the modification time of a remote file/directory
|
FileInfo |
stat(String path)
get file information for the given file/dir (which is relative to the
current dir)
|
RsyncStats |
syncLocalFile(String remoteMaster,
File localSlave)
sync a local file with its up-to-date remote version
|
RsyncStats |
syncRemoteFile(File localMaster,
String remoteSlave)
sync a remote file with its up-to-date local version
|
void |
writeAll(String remoteFile,
InputStream localSource)
write all the data from the input stream to a remote file
|
cancel, cleanup, closeData, connect, createSocket, createSocket, getAuthtimeout, getBufferSize, getKey, getNumConnections, getProgressListener, getSecret, getServerFeatures, getServerList, getTimeout, isCompress, isConnected, openDataConnection, prepareGet, preparePut, setAuthtimeout, setBufferSize, setCompress, setKey, setNumConnections, setProgressListener, setSecret, setTimeoutpublic UFTPSessionClient(InetAddress[] servers, int port)
servers - - list of alternative IP addresses of the UFTP serverport - - the server portpublic void setCommandFile(String commandFile)
public void run()
public void disconnect()
throws IOException
IOExceptionpublic void get(String remoteFile, OutputStream localTarget) throws IOException
remoteFile - - the remote path (relative to the current dir)localTarget - - the local target stream to write toIOExceptionpublic void get(String remoteFile, long offset, long length, OutputStream localTarget) throws IOException
remoteFile - - the remote fileoffset - - the first byte to read, starting at "0"length - - the number of bytes to readlocalTarget - - the local stream to write toIOExceptionpublic void put(String remoteFile, long size, long offset, InputStream localSource) throws IOException
remoteFile - - the remote filesize - - number of bytes to writeoffset - - the offset to start writing the remote file atlocalSource - - the local stream to read fromIOExceptionpublic void put(String remoteFile, long size, InputStream localSource) throws IOException
remoteFile - - the remote filesize - - number of bytes to writelocalSource - - the local stream to read fromIOExceptionpublic void writeAll(String remoteFile, InputStream localSource) throws IOException
remoteFile - - the remote filelocalSource - - the local stream to read fromIOExceptionpublic List<String> getFileList(String baseDir) throws IOException
baseDir - - the base dirIOExceptionpublic List<FileInfo> getFileInfoList(String baseDir) throws IOException
baseDir - - the base dirIOExceptionpublic FileInfo stat(String path) throws IOException
path - - the path of the file to statIOExceptionpublic long getFileSize(String pathName) throws IOException
IOExceptionpublic void cd(String dir) throws IOException
dir - - the dir to change to, relative to the current oneIOExceptionpublic void cdUp()
throws IOException
IOExceptionpublic void mkdir(String dir) throws IOException
dir - - the dir to create, either absolute or relative to the
current oneIOExceptionpublic void rm(String path) throws IOException
path - - the file/dir to delete, either absolute or relative to the
current oneIOExceptionpublic void rename(String from, String to) throws IOException
from - - the file/dir to rename, either absolute or relative to the current dirto - - the target file name, either absolute or relative to the current dirIOExceptionpublic void setModificationTime(String path, Calendar to) throws IOException
target - - the file/dir to modifyto - - the desired modification timeIOExceptionpublic String pwd() throws IOException
IOExceptionpublic RsyncStats syncLocalFile(String remoteMaster, File localSlave) throws Exception
remoteMaster - - the remote file (up of date)localSlave - - the local file (out of date)Exceptionpublic RsyncStats syncRemoteFile(File localMaster, String remoteSlave) throws Exception
localMaster - - the local file (up of date)remoteSlave - - the remote file (out of date)Exceptionpublic void setBaseDirectory(File base)
base - - the base directorypublic File getBaseDirectory()
public static String makeCommandline(String host, int port, String baseDirectory, String secret, int numStreams, String encryptionKey, int bufferSize, boolean compress, String commandFile)
host - - server host (can be a comma separated list of addresses)port - - server portbaseDirectory - - local base directorysecret - - the secretnumStreams - - the number of streamsencryptionKey - - encryption key (base64), if null, no
encryption will be usedbufferSize - - size of the buffercommandFile - - file to read commands frompublic static UFTPSessionClient create(String[] args) throws UnknownHostException, FileNotFoundException
args - UnknownHostExceptionFileNotFoundExceptionCopyright © 2010–2016 UNICORE. All rights reserved.