public String checksum(ChecksumAlgorithm algorithm,
                           long offset, long length, String file)
        throws IOException, ServerException {
        String arguments = algorithm.toFtpCmdArgument() + " " +
            String.valueOf(offset) + " " +
            String.valueOf(length) + " " + file;

        Command cmd = new Command("CKSM", arguments);
        Reply reply = null;
        try {
            reply = controlChannel.execute(cmd);
            return reply.getMessage();
        } catch (UnexpectedReplyCodeException urce) {
            throw ServerException.embedUnexpectedReplyCodeException(urce);
        } catch (FTPReplyParseException rpe) {
            throw ServerException.embedFTPReplyParseException(rpe);
        }
    }
public String checksum ( ChecksumAlgorithm algorithm , long offset , long length , String file ) throws IOException , ServerException { String arguments = algorithm . toFtpCmdArgument ( ) + " " + String . valueOf ( offset ) + " " + String . valueOf ( length ) + " " + file ; Command cmd = new Command ( "CKSM" , arguments ) ; Reply reply = null ; try { reply = controlChannel . execute ( cmd ) ; return reply . getMessage ( ) ; } catch ( UnexpectedReplyCodeException urce ) { throw ServerException . embedUnexpectedReplyCodeException ( urce ) ; } catch ( FTPReplyParseException rpe ) { throw ServerException . embedFTPReplyParseException ( rpe ) ; } }
Computes and returns a checksum of a file.
transferred.

@param algorithm the checksume algorithm
@param offset the offset
@param length the length
@param file file to compute checksum of
@return the computed checksum
@exception ServerException if an error occured.