public class FTPClient
extends java.lang.Object
setMode(), setType() that
affect data channel settings must be called before passive
or active data channel mode is set.| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<java.lang.String> |
algorithms
List of the checksum algorithms supported by the server as described in
GridFTP v2 Protocol Description
|
protected FTPControlChannel |
controlChannel |
protected java.text.SimpleDateFormat |
dateFormat |
protected FTPServerFacade |
localServer |
static java.util.regex.Pattern |
portPattern
Regular expression for matching the port information of a
GFD.47 127 reply.
|
protected Session |
session |
protected boolean |
useAllo
Whether to use ALLO with put()/asyncPut() or not
|
protected java.lang.String |
username |
| Modifier | Constructor and Description |
|---|---|
protected |
FTPClient() |
|
FTPClient(java.lang.String host,
int port)
Constructs client and connects it to the remote server.
|
| Modifier and Type | Method and Description |
|---|---|
void |
abort()
Aborts the current transfer.
|
protected void |
actualSetMode(int mode,
java.lang.String modeStr) |
void |
allocate(long size)
Reserve sufficient storage to accommodate the new file to be
transferred.
|
TransferState |
asynchGet(java.lang.String remoteFileName,
DataSink sink,
MarkerListener mListener)
Retrieves the file from the remote server.
|
TransferState |
asynchGet2(java.lang.String remoteFileName,
boolean passive,
DataSink sink,
MarkerListener mListener)
Retrieves a file asynchronously using the GFD.47 (a.k.a
GridFTP2) GET command.
|
TransferState |
asynchPut(java.lang.String remoteFileName,
DataSource source,
MarkerListener mListener)
Stores file at the remote server.
|
TransferState |
asynchPut(java.lang.String remoteFileName,
DataSource source,
MarkerListener mListener,
boolean append)
Stores file at the remote server.
|
TransferState |
asynchPut2(java.lang.String remoteFileName,
boolean passive,
DataSource source,
MarkerListener mListener)
Stores a file at the remote server using the GFD.47 (a.k.a
GridFTP2) PUT command.
|
void |
authorize(java.lang.String user,
java.lang.String password)
Performs user authorization with specified
user and password.
|
void |
changeDir(java.lang.String dir)
Changes the remote current working directory.
|
protected void |
checkGETPUTSupport()
Throws ServerException if GFD.47 GETPUT is not supported or
cannot be used.
|
protected void |
checkTransferParams() |
protected void |
checkTransferParamsGet() |
protected void |
checkTransferParamsPut() |
void |
close()
Closes connection.
|
void |
close(boolean ignoreQuitReply)
Closes connection.
|
void |
deleteDir(java.lang.String dir)
Deletes the remote directory.
|
void |
deleteFile(java.lang.String filename)
Deletes the remote file.
|
boolean |
exists(java.lang.String filename)
Checks if given file/directory exists on the server.
|
void |
get(java.lang.String remoteFileName,
DataSink sink,
MarkerListener mListener)
Retrieves the file from the remote server.
|
void |
get(java.lang.String remoteFileName,
java.io.File localFile) |
protected HostPort |
get127Reply()
Reads a GFD.47 compliant 127 reply and extracts the port
information from it.
|
void |
get2(java.lang.String remoteFileName,
boolean passive,
DataSink sink,
MarkerListener mListener)
Retrieves a file using the GFD.47 (a.k.a GridFTP2) GET command.
|
java.lang.String |
getChecksum(java.lang.String algorithm,
long offset,
long length,
java.lang.String path)
implement GridFTP v2 CKSM command from
GridFTP v2 Protocol Description
|
java.lang.String |
getChecksum(java.lang.String algorithm,
java.lang.String path)
GridFTP v2 CKSM command for the whole file
|
java.lang.String |
getCurrentDir()
Returns remote current working directory.
|
FeatureList |
getFeatureList()
Returns list of features supported by remote server.
|
java.lang.String |
getHost() |
java.util.Date |
getLastModified(java.lang.String filename)
Returns last modification time of the specifed file.
|
Reply |
getLastReply()
Returns the last reply received from the server.
|
protected java.lang.String |
getModeStr(int mode) |
int |
getPort() |
long |
getSize(java.lang.String filename)
Returns the remote file size.
|
java.util.List<java.lang.String> |
getSupportedCksumAlgorithms()
According to
GridFTP v2 Protocol Description
checksum feature has the following syntax:
|
boolean |
getUseAllo()
Determines whether this client is configured to send an ALLO
command before a STOR request in the put/asyncPut methods.
|
java.lang.String |
getUserName() |
void |
goUpDir()
Changes remote current working directory to the higher level.
|
boolean |
isActiveMode() |
boolean |
isCksumAlgorithmSupported(java.lang.String algorithm) |
boolean |
isFeatureSupported(java.lang.String feature)
Returns true if the given feature is supported by remote server,
false otherwise.
|
boolean |
isPassiveMode() |
java.util.Date |
lastModified(java.lang.String filename) |
java.util.Vector |
list()
Performs remote directory listing.
|
java.util.Vector |
list(java.lang.String filter)
Performs remote directory listing with the specified filter.
|
java.util.Vector |
list(java.lang.String filter,
java.lang.String modifier)
Performs remote directory listing with the specified filter and
modifier.
|
void |
list(java.lang.String filter,
java.lang.String modifier,
DataSink sink)
Performs directory listing and writes the result
to the supplied data sink.
|
protected void |
listCheck()
check performed at the beginning of list()
|
void |
makeDir(java.lang.String dir)
Creates remote directory.
|
java.util.Vector |
mlsd()
Performs remote directory listing of the current directory.
|
java.util.Vector |
mlsd(java.lang.String path)
Performs remote directory listing on the given path.
|
void |
mlsd(java.lang.String path,
DataSink sink)
Performs remote directory listing on the given path.
|
MlsxEntry |
mlst(java.lang.String fileName)
Get info of a certain remote file in Mlsx format.
|
java.util.Vector |
nlist()
Performs remote directory listing of the current directory.
|
java.util.Vector |
nlist(java.lang.String path)
Performs remote directory listing on the given path.
|
void |
nlist(java.lang.String path,
DataSink sink)
Performs remote directory listing on the given path.
|
protected void |
performTransfer(Command cmd,
DataSink sink) |
void |
put(java.io.File localFile,
java.lang.String remoteFileName,
boolean append) |
void |
put(java.lang.String remoteFileName,
DataSource source,
MarkerListener mListener)
Stores file at the remote server.
|
void |
put(java.lang.String remoteFileName,
DataSource source,
MarkerListener mListener,
boolean append)
Stores file at the remote server.
|
void |
put2(java.lang.String remoteFileName,
boolean passive,
DataSource source,
MarkerListener mListener)
Stores a file at the remote server using the GFD.47 (a.k.a
GridFTP2) PUT command.
|
Reply |
quote(java.lang.String command)
Executes arbitrary operation on the server.
|
void |
rename(java.lang.String oldName,
java.lang.String newName)
Renames remote directory.
|
void |
setActive()
Sets remote server active, telling it to connect to the client.
|
void |
setActive(HostPort hostPort)
Sets remote server active, telling it to connect to the given
address.
|
void |
setChecksum(java.lang.String algorithm,
java.lang.String value)
implement GridFTP v2 SCKS command as described in
GridFTP v2 Protocol Description
|
void |
setClientWaitParams(int maxWait,
int waitDelay)
Changes the default client timeout parameters.
|
void |
setLocalActive()
Starts local server in active server mode.
|
HostPort |
setLocalPassive()
Starts local server in passive server mode, with default parameters.
|
HostPort |
setLocalPassive(int port,
int queue)
Starts the local server in passive server mode.
|
void |
setMode(int mode)
Sets transfer mode.
|
void |
setOptions(Options opts)
Sets the supplied options to the server.
|
HostPort |
setPassive()
Sets remote server to passive server mode.
|
void |
setPassiveMode(boolean passiveMode)
Enables/disables passive data connections.
|
void |
setProtectionBufferSize(int size)
Sets protection buffer size (defined in RFC 2228)
|
void |
setRestartMarker(RestartData restartData)
Sets restart parameter of the next transfer.
|
void |
setType(int type)
Sets transfer type.
|
void |
setUseAllo(boolean useAllo)
Controls whether the client attempts to send an ALLO command
before a STOR request during the put/asyncPut calls.
|
Reply |
site(java.lang.String args)
Executes site-specific operation (using the SITE command).
|
long |
size(java.lang.String filename) |
static void |
transfer(FTPClient source,
java.lang.String remoteSrcFile,
FTPClient destination,
java.lang.String remoteDstFile,
int mode,
MarkerListener mListener)
Performs third-party transfer between two servers.
|
void |
transfer(java.lang.String remoteSrcFile,
FTPClient destination,
java.lang.String remoteDstFile,
boolean append,
MarkerListener mListener)
Performs third-party transfer between two servers.
|
protected TransferState |
transferBegin(BasicClientControlChannel other,
MarkerListener mListener) |
protected void |
transferRun(BasicClientControlChannel other,
MarkerListener mListener)
Actual transfer management.
|
protected void |
transferRunSingleThread(BasicClientControlChannel other,
MarkerListener mListener) |
protected TransferState |
transferStart(BasicClientControlChannel other,
MarkerListener mListener) |
protected void |
transferWait(TransferState transferState) |
protected Session session
protected FTPControlChannel controlChannel
protected FTPServerFacade localServer
protected java.text.SimpleDateFormat dateFormat
protected java.lang.String username
protected boolean useAllo
protected java.util.List<java.lang.String> algorithms
public static final java.util.regex.Pattern portPattern
protected FTPClient()
public FTPClient(java.lang.String host,
int port)
throws java.io.IOException,
ServerException
host - remote server hostport - remote server portjava.io.IOExceptionServerExceptionpublic java.lang.String getHost()
public int getPort()
public Reply getLastReply()
public long getSize(java.lang.String filename)
throws java.io.IOException,
ServerException
filename - filename get the size for.ServerException - if the file does not exist or
an error occured.java.io.IOExceptionpublic java.util.Date getLastModified(java.lang.String filename)
throws java.io.IOException,
ServerException
filename - filename get the last modification time for.ServerException - if the file does not exist or
an error occured.java.io.IOExceptionpublic boolean exists(java.lang.String filename)
throws java.io.IOException,
ServerException
filename - file or directory namejava.io.IOExceptionServerExceptionpublic void changeDir(java.lang.String dir)
throws java.io.IOException,
ServerException
java.io.IOExceptionServerExceptionpublic void deleteDir(java.lang.String dir)
throws java.io.IOException,
ServerException
java.io.IOExceptionServerExceptionpublic void deleteFile(java.lang.String filename)
throws java.io.IOException,
ServerException
java.io.IOExceptionServerExceptionpublic void makeDir(java.lang.String dir)
throws java.io.IOException,
ServerException
java.io.IOExceptionServerExceptionpublic void rename(java.lang.String oldName,
java.lang.String newName)
throws java.io.IOException,
ServerException
java.io.IOExceptionServerExceptionpublic java.lang.String getCurrentDir()
throws java.io.IOException,
ServerException
java.io.IOExceptionServerExceptionpublic void goUpDir()
throws java.io.IOException,
ServerException
java.io.IOExceptionServerExceptionpublic java.util.Vector list()
throws ServerException,
ClientException,
java.io.IOException
mlsd()
function instead.FileInfo objects, representing
remote filesServerExceptionClientExceptionjava.io.IOExceptionmlsd()public java.util.Vector list(java.lang.String filter)
throws ServerException,
ClientException,
java.io.IOException
mlsd()
function instead. filter - "*" for example, can be null.FileInfo objects, representing
remote filesServerExceptionClientExceptionjava.io.IOExceptionmlsd(String)public java.util.Vector list(java.lang.String filter,
java.lang.String modifier)
throws ServerException,
ClientException,
java.io.IOException
mlsd()
function instead.filter - "*" for example, can be null.modifier - "-d" for example, can be null.FileInfo objects, representing
remote filesServerExceptionClientExceptionjava.io.IOExceptionmlsd(String)public void list(java.lang.String filter,
java.lang.String modifier,
DataSink sink)
throws ServerException,
ClientException,
java.io.IOException
mlsd() function instead.filter - remote list command file filter, eg. "*"modifier - remote list command modifier, eg. "-d"sink - data destinationServerExceptionClientExceptionjava.io.IOExceptionpublic java.util.Vector nlist()
throws ServerException,
ClientException,
java.io.IOException
FileInfo objects, representing
remote filesServerExceptionClientExceptionjava.io.IOExceptionpublic java.util.Vector nlist(java.lang.String path)
throws ServerException,
ClientException,
java.io.IOException
path - directory to perform listing of. If null, listing
of current directory will be performed.FileInfo objects, representing
remote filesServerExceptionClientExceptionjava.io.IOExceptionpublic void nlist(java.lang.String path,
DataSink sink)
throws ServerException,
ClientException,
java.io.IOException
path - directory to perform listing of. If null, listing
of current directory will be performed.sink - sink to which the listing data will be written.ServerExceptionClientExceptionjava.io.IOExceptionpublic MlsxEntry mlst(java.lang.String fileName) throws java.io.IOException, ServerException
java.io.IOExceptionServerExceptionpublic java.util.Vector mlsd()
throws ServerException,
ClientException,
java.io.IOException
MlsxEntry objects, representing
remote filesServerExceptionClientExceptionjava.io.IOExceptionpublic java.util.Vector mlsd(java.lang.String path)
throws ServerException,
ClientException,
java.io.IOException
path - directory to perform listing of. If null, listing
of current directory will be performed.MlsxEntry objects, representing
remote filesServerExceptionClientExceptionjava.io.IOExceptionpublic void mlsd(java.lang.String path,
DataSink sink)
throws ServerException,
ClientException,
java.io.IOException
path - directory to perform listing of. If null, listing
of current directory will be performed.sink - sink to which the listing data will be written.ServerExceptionClientExceptionjava.io.IOExceptionprotected void listCheck()
throws ClientException
ClientExceptionprotected void checkTransferParamsGet()
throws ServerException,
java.io.IOException,
ClientException
ServerExceptionjava.io.IOExceptionClientExceptionprotected void checkTransferParamsPut()
throws ServerException,
java.io.IOException,
ClientException
ServerExceptionjava.io.IOExceptionClientExceptionprotected void checkTransferParams()
throws ServerException,
java.io.IOException,
ClientException
ServerExceptionjava.io.IOExceptionClientExceptionprotected void performTransfer(Command cmd, DataSink sink) throws ServerException, ClientException, java.io.IOException
ServerExceptionClientExceptionjava.io.IOExceptionpublic void setType(int type)
throws java.io.IOException,
ServerException
type - should be TYPE_IMAGE,
TYPE_ASCII,
TYPE_LOCAL,
TYPE_EBCDICjava.io.IOExceptionServerExceptionprotected java.lang.String getModeStr(int mode)
public void setMode(int mode)
throws java.io.IOException,
ServerException
mode - should be MODE_STREAM,
MODE_BLOCKjava.io.IOExceptionServerExceptionprotected void actualSetMode(int mode,
java.lang.String modeStr)
throws java.io.IOException,
ServerException
java.io.IOExceptionServerExceptionpublic void setProtectionBufferSize(int size)
throws java.io.IOException,
ServerException
size - the size of bufferjava.io.IOExceptionServerExceptionpublic void abort()
throws java.io.IOException,
ServerException
java.io.IOExceptionServerExceptionpublic void close()
throws java.io.IOException,
ServerException
java.io.IOExceptionServerExceptionpublic void close(boolean ignoreQuitReply)
throws java.io.IOException,
ServerException
ignoreQuitReply - if true the QUIT command
will be sent but the client will not wait for the
server's reply. If false, the client will block
for the server's reply.java.io.IOExceptionServerExceptionpublic boolean isFeatureSupported(java.lang.String feature)
throws java.io.IOException,
ServerException
java.io.IOExceptionServerExceptionpublic FeatureList getFeatureList() throws java.io.IOException, ServerException
java.io.IOExceptionServerExceptionpublic HostPort setPassive() throws java.io.IOException, ServerException
java.io.IOExceptionServerExceptionpublic void setActive(HostPort hostPort) throws java.io.IOException, ServerException
hostPort - the address to which the server should connectjava.io.IOExceptionServerExceptionpublic void setActive()
throws java.io.IOException,
ServerException,
ClientException
java.io.IOExceptionServerExceptionClientExceptionpublic void setLocalActive()
throws ClientException,
java.io.IOException
ClientExceptionjava.io.IOExceptionpublic HostPort setLocalPassive() throws java.io.IOException
java.io.IOExceptionpublic HostPort setLocalPassive(int port, int queue) throws java.io.IOException
port - port at which local server should be listening;
can be set to FTPServerFacade.ANY_PORTqueue - max size of queue of awaiting new connection
requestsjava.io.IOExceptionpublic void setClientWaitParams(int maxWait,
int waitDelay)
maxWait - timeout in milisecondswaitDelay - polling periodpublic void setOptions(Options opts) throws java.io.IOException, ServerException
java.io.IOExceptionServerExceptionpublic void setRestartMarker(RestartData restartData) throws java.io.IOException, ServerException
restartData - marker to useServerException - if the file does not exist or
an error occured.java.io.IOExceptionpublic void authorize(java.lang.String user,
java.lang.String password)
throws java.io.IOException,
ServerException
user - usernamepassword - user passwordServerException - on server refusaljava.io.IOExceptionpublic java.lang.String getUserName()
public void get(java.lang.String remoteFileName,
DataSink sink,
MarkerListener mListener)
throws java.io.IOException,
ClientException,
ServerException
remoteFileName - remote file namesink - sink to which the data will be writtenmListener - restart marker listener (currently not used)java.io.IOExceptionClientExceptionServerExceptionpublic TransferState asynchGet(java.lang.String remoteFileName, DataSink sink, MarkerListener mListener) throws java.io.IOException, ClientException, ServerException
remoteFileName - remote file namesink - sink to which the data will be writtenmListener - restart marker listener (currently not used)java.io.IOExceptionClientExceptionServerExceptionpublic void put(java.lang.String remoteFileName,
DataSource source,
MarkerListener mListener)
throws java.io.IOException,
ServerException,
ClientException
remoteFileName - remote file namesource - data will be read from heremListener - restart marker listener (currently not used)java.io.IOExceptionServerExceptionClientExceptionpublic void put(java.lang.String remoteFileName,
DataSource source,
MarkerListener mListener,
boolean append)
throws java.io.IOException,
ServerException,
ClientException
remoteFileName - remote file namesource - data will be read from heremListener - restart marker listener (currently not used)append - append to the end of file or overwritejava.io.IOExceptionServerExceptionClientExceptionpublic TransferState asynchPut(java.lang.String remoteFileName, DataSource source, MarkerListener mListener) throws java.io.IOException, ServerException, ClientException
remoteFileName - remote file namesource - data will be read from heremListener - restart marker listener (currently not used)java.io.IOExceptionServerExceptionClientExceptionpublic TransferState asynchPut(java.lang.String remoteFileName, DataSource source, MarkerListener mListener, boolean append) throws java.io.IOException, ServerException, ClientException
remoteFileName - remote file namesource - data will be read from heremListener - restart marker listener (currently not used)append - append to the end of file or overwritejava.io.IOExceptionServerExceptionClientExceptionpublic void transfer(java.lang.String remoteSrcFile,
FTPClient destination,
java.lang.String remoteDstFile,
boolean append,
MarkerListener mListener)
throws java.io.IOException,
ServerException,
ClientException
remoteSrcFile - source filenamedestination - another client connected to destination serverremoteDstFile - destination filenameappend - enables append mode; if true,
data will be appened to the remote file, otherwise
file will be overwritten.mListener - marker listener.
Can be set to null.java.io.IOExceptionServerExceptionClientExceptionprotected void transferRun(BasicClientControlChannel other, MarkerListener mListener) throws java.io.IOException, ServerException, ClientException
java.io.IOExceptionServerExceptionClientExceptionprotected TransferState transferBegin(BasicClientControlChannel other, MarkerListener mListener)
protected TransferState transferStart(BasicClientControlChannel other, MarkerListener mListener) throws java.io.IOException, ServerException, ClientException
java.io.IOExceptionServerExceptionClientExceptionprotected void transferWait(TransferState transferState) throws java.io.IOException, ServerException, ClientException
java.io.IOExceptionServerExceptionClientExceptionprotected void transferRunSingleThread(BasicClientControlChannel other, MarkerListener mListener) throws java.io.IOException, ServerException, ClientException
java.io.IOExceptionServerExceptionClientExceptionpublic Reply quote(java.lang.String command) throws java.io.IOException, ServerException
command - command to executejava.io.IOException - in case of I/O error.ServerException - if operation failed.public Reply site(java.lang.String args) throws java.io.IOException, ServerException
args - parameters for the SITE operation.java.io.IOException - in case of I/O errorServerException - if operation failed.public void allocate(long size)
throws java.io.IOException,
ServerException
size - the amount of space to reserveServerException - if an error occured.java.io.IOExceptionpublic long size(java.lang.String filename)
throws java.io.IOException,
ServerException
java.io.IOExceptionServerExceptionpublic java.util.Date lastModified(java.lang.String filename)
throws java.io.IOException,
ServerException
java.io.IOExceptionServerExceptionpublic void get(java.lang.String remoteFileName,
java.io.File localFile)
throws java.io.IOException,
ClientException,
ServerException
java.io.IOExceptionClientExceptionServerExceptionpublic void put(java.io.File localFile,
java.lang.String remoteFileName,
boolean append)
throws java.io.IOException,
ServerException,
ClientException
java.io.IOExceptionServerExceptionClientExceptionpublic void setPassiveMode(boolean passiveMode)
throws java.io.IOException,
ClientException,
ServerException
passiveMode - if true passive connections will be
established. If false, they will not.java.io.IOExceptionClientExceptionServerExceptionpublic boolean isPassiveMode()
protected void checkGETPUTSupport()
throws ServerException,
java.io.IOException
ServerExceptionjava.io.IOExceptionprotected HostPort get127Reply() throws ServerException, java.io.IOException, FTPReplyParseException
ServerExceptionjava.io.IOExceptionFTPReplyParseExceptionpublic void get2(java.lang.String remoteFileName,
boolean passive,
DataSink sink,
MarkerListener mListener)
throws java.io.IOException,
ClientException,
ServerException
remoteFileName - file to retrievepassive - whether to configure the server to be passivesink - data sink to store the filemListener - marker listenerjava.io.IOExceptionClientExceptionServerExceptionpublic TransferState asynchGet2(java.lang.String remoteFileName, boolean passive, DataSink sink, MarkerListener mListener) throws java.io.IOException, ClientException, ServerException
remoteFileName - file to retrievepassive - whether to configure the server to be passivesink - data sink to store the filemListener - marker listenerjava.io.IOExceptionClientExceptionServerExceptionpublic void put2(java.lang.String remoteFileName,
boolean passive,
DataSource source,
MarkerListener mListener)
throws java.io.IOException,
ClientException,
ServerException
remoteFileName - file to retrievepassive - whether to configure the server to be passivesource - data will be read from heremListener - marker listenerjava.io.IOExceptionClientExceptionServerExceptionpublic TransferState asynchPut2(java.lang.String remoteFileName, boolean passive, DataSource source, MarkerListener mListener) throws java.io.IOException, ClientException, ServerException
remoteFileName - file to retrievepassive - whether to configure the server to be passivesource - data will be read from heremListener - marker listenerjava.io.IOExceptionClientExceptionServerExceptionpublic static void transfer(FTPClient source, java.lang.String remoteSrcFile, FTPClient destination, java.lang.String remoteDstFile, int mode, MarkerListener mListener) throws java.io.IOException, ServerException, ClientException
source - client connected to source serverremoteSrcFile - source filenamedestination - client connected to destination serverremoteDstFile - destination filenamemode - data channel mode or 0 to use the current modemListener - marker listener.
Can be set to null.java.io.IOExceptionServerExceptionClientExceptionpublic boolean isActiveMode()
public void setUseAllo(boolean useAllo)
useAllo - true if the client should try
to send an ALLO command before a STOR requestpublic boolean getUseAllo()
public java.util.List<java.lang.String> getSupportedCksumAlgorithms()
throws ClientException,
ServerException,
java.io.IOException
CKSUMgetSupportedCksumAlgorithms parses checsum feauture parms and form a list of checksum algorithms supported by the server[, …]
ClientExceptionorg.globus.ftp.org.globus.ftp.exception.ServerExceptionjava.io.IOExceptionServerExceptionpublic boolean isCksumAlgorithmSupported(java.lang.String algorithm)
throws ClientException,
ServerException,
java.io.IOException
ClientExceptionServerExceptionjava.io.IOExceptionpublic java.lang.String getChecksum(java.lang.String algorithm,
long offset,
long length,
java.lang.String path)
throws ClientException,
ServerException,
java.io.IOException
5.1 CKSM This command is used by the client to request checksum calculation over a portion or whole file existing on the server. The syntax is: CKSMCRLF Server executes this command by calculating specified type of checksum over portion of the file starting at the offset and of the specified length. If length is –1, the checksum will be calculated through the end of the file. On success, the server replies with 2xx Actual format of checksum value depends on the algorithm used, but generally, hexadecimal representation should be used.
algorithm - ckeckum alorithmoffset - length - path - ClientExceptionorg.globus.ftp.org.globus.ftp.exception.ServerExceptionjava.io.IOExceptionServerExceptionpublic java.lang.String getChecksum(java.lang.String algorithm,
java.lang.String path)
throws ClientException,
ServerException,
java.io.IOException
algorithm - ckeckum alorithmpath - ClientExceptionorg.globus.ftp.org.globus.ftp.exception.ServerExceptionjava.io.IOExceptionServerExceptionpublic void setChecksum(java.lang.String algorithm,
java.lang.String value)
throws ClientException,
ServerException,
java.io.IOException
5.2 SCKS This command is sent prior to upload command such as STOR, ESTO, PUT. It is used to convey to the server that the checksum value for the file which is about to be uploaded. At the end of transfer, server will calculate checksum for the received file, and if it does not match, will consider the transfer to have failed. Syntax of the command is: SCKSCRLF Actual format of checksum value depends on the algorithm used, but generally, hexadecimal representation should be used.
algorithm - value - ClientExceptionorg.globus.ftp.org.globus.ftp.exception.ServerExceptionjava.io.IOExceptionServerExceptionCopyright © 2013. All Rights Reserved.