Example usage for org.apache.commons.net.ftp FTPReply COMMAND_OK

List of usage examples for org.apache.commons.net.ftp FTPReply COMMAND_OK

Introduction

In this page you can find the example usage for org.apache.commons.net.ftp FTPReply COMMAND_OK.

Prototype

int COMMAND_OK

To view the source code for org.apache.commons.net.ftp FTPReply COMMAND_OK.

Click Source Link

Usage

From source file:ch.cyberduck.core.ftp.FTPClient.java

@Override
public void execPROT(final String prot) throws IOException {
    if (protocol.isSecure()) {
        if (FTPReply.COMMAND_OK != this.sendCommand("PROT", prot)) {
            throw new FTPException(this.getReplyCode(), this.getReplyString());
        }/*from w  ww .j ava  2s .  c  o  m*/
        if ("P".equals(prot)) {
            // Private
            this.setSocketFactory(sslSocketFactory);
        }
    }
}

From source file:ch.cyberduck.core.ftp.FTPClient.java

@Override
public void execPBSZ(final long pbsz) throws IOException {
    if (protocol.isSecure()) {
        if (FTPReply.COMMAND_OK != this.sendCommand("PBSZ", String.valueOf(pbsz))) {
            throw new FTPException(this.getReplyCode(), this.getReplyString());
        }/*from w w  w.jav a2  s.co m*/
    }
}

From source file:org.apache.maven.wagon.providers.ftp.FtpWagon.java

public boolean resourceExists(String resourceName) throws TransferFailedException, AuthorizationException {
    Resource resource = new Resource(resourceName);

    try {//from w w w  .  j a  v a  2 s . c o m
        ftpChangeDirectory(resource);

        String filename = PathUtils.filename(resource.getName());
        int status = ftp.stat(filename);

        return ((status == FTPReply.FILE_STATUS) || (status == FTPReply.DIRECTORY_STATUS)
                || (status == FTPReply.FILE_STATUS_OK) // not in the RFC but used by some FTP servers
                || (status == FTPReply.COMMAND_OK) // not in the RFC but used by some FTP servers
                || (status == FTPReply.SYSTEM_STATUS));
    } catch (IOException e) {
        throw new TransferFailedException("Error transferring file via FTP", e);
    } catch (ResourceDoesNotExistException e) {
        return false;
    }
}