@Override public void setFileType(int fileType) throws IOException { ftpsClient.setFileType(fileType); }
/** * Set the {@link TransferMode} that this protocol should use * * @param mode * @throws FileTransferException */ @Override public void setTransferMode( TransferMode mode ) throws FileTransferException { if (this.ftpsConnection != null && this.ftpsConnection.isConnected() && this.transferMode != mode) { try { log.info("Set file transfer mode to " + mode); if (mode == TransferMode.ASCII) { if (!this.ftpsConnection.setFileType(org.apache.commons.net.ftp.FTPSClient.ASCII_FILE_TYPE)) { throw new Exception("Unable to set transfer mode to ASCII"); } } else { if (!this.ftpsConnection.setFileType(org.apache.commons.net.ftp.FTPSClient.BINARY_FILE_TYPE)) { throw new Exception("Unable to set transfer mode to BINARY"); } } } catch (Exception e) { throw new FileTransferException("Error setting file transfer mode to " + mode, e); } } super.setTransferMode(mode); }
ftpClient.setFileType(FTP.BINARY_FILE_TYPE); ftpClient.enterLocalPassiveMode(); BufferedInputStream buffIn = null;
if (!this.ftpsConnection.setFileType(org.apache.commons.net.ftp.FTPSClient.ASCII_FILE_TYPE)) { throw new Exception("Unable to set transfer mode to ASCII"); if (!this.ftpsConnection.setFileType(org.apache.commons.net.ftp.FTPSClient.BINARY_FILE_TYPE)) { throw new Exception("Unable to set transfer mode to BINARY");
ftpClient.setFileType(FTP.BINARY_FILE_TYPE); logger.info("Successfully logged in to [" + remoteHostname + "] with user [" + username + "]");
@Override public boolean connectClient() throws IOException { boolean isLoggedIn = true; client.setAutodetectUTF8(true); client.setControlEncoding("UTF-8"); client.connect(host, port); client.setFileType(FTP.BINARY_FILE_TYPE); client.enterLocalPassiveMode(); client.login(username, password); int reply = client.getReplyCode(); if (!FTPReply.isPositiveCompletion(reply)) { client.disconnect(); LogUtils.LOGD(TAG, "Negative reply form FTP server, aborting, id was {}:"+ reply); //throw new IOException("failed to connect to FTP server"); isLoggedIn = false; } return isLoggedIn; }