List of usage examples for org.apache.commons.net.ftp FTPReply isPositiveCompletion
public static boolean isPositiveCompletion(int reply)
From source file:com.atomicleopard.thundr.ftp.commons.FTPClient.java
/** * Logout of the FTP server by sending the QUIT command. * <p>/* w w w . j av a 2 s . com*/ * @return True if successfully completed, false if not. * @exception FTPConnectionClosedException * If the FTP server prematurely closes the connection as a result * of the client being idle or some other reason causing the server * to send FTP reply code 421. This exception may be caught either * as an IOException or independently as itself. * @exception IOException If an I/O error occurs while either sending a * command to the server or receiving a reply from the server. */ public boolean logout() throws IOException { return FTPReply.isPositiveCompletion(quit()); }
From source file:com.atomicleopard.thundr.ftp.commons.FTPClient.java
/** * Change the current working directory of the FTP session. * <p>//from ww w . jav a2 s . com * @param pathname The new current working directory. * @return True if successfully completed, false if not. * @exception FTPConnectionClosedException * If the FTP server prematurely closes the connection as a result * of the client being idle or some other reason causing the server * to send FTP reply code 421. This exception may be caught either * as an IOException or independently as itself. * @exception IOException If an I/O error occurs while either sending a * command to the server or receiving a reply from the server. */ public boolean changeWorkingDirectory(String pathname) throws IOException { return FTPReply.isPositiveCompletion(cwd(pathname)); }
From source file:com.atomicleopard.thundr.ftp.commons.FTPClient.java
/** * Change to the parent directory of the current working directory. * <p>//from w w w .jav a2s. c o m * @return True if successfully completed, false if not. * @exception FTPConnectionClosedException * If the FTP server prematurely closes the connection as a result * of the client being idle or some other reason causing the server * to send FTP reply code 421. This exception may be caught either * as an IOException or independently as itself. * @exception IOException If an I/O error occurs while either sending a * command to the server or receiving a reply from the server. */ public boolean changeToParentDirectory() throws IOException { return FTPReply.isPositiveCompletion(cdup()); }
From source file:com.atomicleopard.thundr.ftp.commons.FTPClient.java
/** * Issue the FTP SMNT command./*from w w w.j av a 2 s .c om*/ * <p> * @param pathname The pathname to mount. * @return True if successfully completed, false if not. * @exception FTPConnectionClosedException * If the FTP server prematurely closes the connection as a result * of the client being idle or some other reason causing the server * to send FTP reply code 421. This exception may be caught either * as an IOException or independently as itself. * @exception IOException If an I/O error occurs while either sending a * command to the server or receiving a reply from the server. */ public boolean structureMount(String pathname) throws IOException { return FTPReply.isPositiveCompletion(smnt(pathname)); }
From source file:com.atomicleopard.thundr.ftp.commons.FTPClient.java
/** * Reinitialize the FTP session. Not all FTP servers support this * command, which issues the FTP REIN command. * <p>/*w ww. j a va 2 s . c o m*/ * @return True if successfully completed, false if not. * @exception FTPConnectionClosedException * If the FTP server prematurely closes the connection as a result * of the client being idle or some other reason causing the server * to send FTP reply code 421. This exception may be caught either * as an IOException or independently as itself. * @exception IOException If an I/O error occurs while either sending a * command to the server or receiving a reply from the server. */ boolean reinitialize() throws IOException { rein(); if (FTPReply.isPositiveCompletion(_replyCode) || (FTPReply.isPositivePreliminary(_replyCode) && FTPReply.isPositiveCompletion(getReply()))) { __initDefaults(); return true; } return false; }
From source file:com.atomicleopard.thundr.ftp.commons.FTPClient.java
/** * Set the current data connection mode to * <code> ACTIVE_REMOTE_DATA_CONNECTION </code>. Use this method only * for server to server data transfers. This method issues a PORT * command to the server, indicating the other server and port to which * it should connect for data transfers. You must call this method * before EVERY server to server transfer attempt. The FTPClient will * NOT automatically continue to issue PORT commands. You also * must remember to call//w ww . j av a 2s.c o m * {@link #enterLocalActiveMode enterLocalActiveMode() } if you * wish to return to the normal data connection mode. * <p> * @param host The passive mode server accepting connections for data * transfers. * @param port The passive mode server's data port. * @return True if successfully completed, false if not. * @exception FTPConnectionClosedException * If the FTP server prematurely closes the connection as a result * of the client being idle or some other reason causing the server * to send FTP reply code 421. This exception may be caught either * as an IOException or independently as itself. * @exception IOException If an I/O error occurs while either sending a * command to the server or receiving a reply from the server. */ public boolean enterRemoteActiveMode(InetAddress host, int port) throws IOException { if (FTPReply.isPositiveCompletion(port(host, port))) { __dataConnectionMode = ACTIVE_REMOTE_DATA_CONNECTION_MODE; __passiveHost = null; __passivePort = -1; return true; } return false; }
From source file:com.atomicleopard.thundr.ftp.commons.FTPClient.java
/** * Sets the file type to be transferred. This should be one of * <code> FTP.ASCII_FILE_TYPE </code>, <code> FTP.BINARY_FILE_TYPE</code>, * etc. The file type only needs to be set when you want to change the * type. After changing it, the new type stays in effect until you change * it again. The default file type is <code> FTP.ASCII_FILE_TYPE </code> * if this method is never called.//from w w w .jav a2 s .c o m * <br> * The server default is supposed to be ASCII (see RFC 959), however many * ftp servers default to BINARY. <b>To ensure correct operation with all servers, * always specify the appropriate file type after connecting to the server.</b> * <br> * <p> * <b>N.B.</b> currently calling any connect method will reset the type to * FTP.ASCII_FILE_TYPE. * @param fileType The <code> _FILE_TYPE </code> constant indcating the * type of file. * @return True if successfully completed, false if not. * @exception FTPConnectionClosedException * If the FTP server prematurely closes the connection as a result * of the client being idle or some other reason causing the server * to send FTP reply code 421. This exception may be caught either * as an IOException or independently as itself. * @exception IOException If an I/O error occurs while either sending a * command to the server or receiving a reply from the server. */ public boolean setFileType(int fileType) throws IOException { if (FTPReply.isPositiveCompletion(type(fileType))) { __fileType = fileType; __fileFormat = FTP.NON_PRINT_TEXT_FORMAT; return true; } return false; }
From source file:com.atomicleopard.thundr.ftp.commons.FTPClient.java
/** * Sets the file type to be transferred and the format. The type should be * one of <code> FTP.ASCII_FILE_TYPE </code>, * <code> FTP.BINARY_FILE_TYPE </code>, etc. The file type only needs to * be set when you want to change the type. After changing it, the new * type stays in effect until you change it again. The default file type * is <code> FTP.ASCII_FILE_TYPE </code> if this method is never called. * <br>/*from w w w. ja va 2s. co m*/ * The server default is supposed to be ASCII (see RFC 959), however many * ftp servers default to BINARY. <b>To ensure correct operation with all servers, * always specify the appropriate file type after connecting to the server.</b> * <br> * The format should be one of the FTP class <code> TEXT_FORMAT </code> * constants, or if the type is <code> FTP.LOCAL_FILE_TYPE </code>, the * format should be the byte size for that type. The default format * is <code> FTP.NON_PRINT_TEXT_FORMAT </code> if this method is never * called. * <p> * <b>N.B.</b> currently calling any connect method will reset the type to * FTP.ASCII_FILE_TYPE and the formatOrByteSize to FTP.NON_PRINT_TEXT_FORMAT. * <p> * @param fileType The <code> _FILE_TYPE </code> constant indcating the * type of file. * @param formatOrByteSize The format of the file (one of the * <code>_FORMAT</code> constants. In the case of * <code>LOCAL_FILE_TYPE</code>, the byte size. * <p> * @return True if successfully completed, false if not. * @exception FTPConnectionClosedException * If the FTP server prematurely closes the connection as a result * of the client being idle or some other reason causing the server * to send FTP reply code 421. This exception may be caught either * as an IOException or independently as itself. * @exception IOException If an I/O error occurs while either sending a * command to the server or receiving a reply from the server. */ public boolean setFileType(int fileType, int formatOrByteSize) throws IOException { if (FTPReply.isPositiveCompletion(type(fileType, formatOrByteSize))) { __fileType = fileType; __fileFormat = formatOrByteSize; return true; } return false; }
From source file:com.atomicleopard.thundr.ftp.commons.FTPClient.java
/** * Sets the file structure. The default structure is * <code> FTP.FILE_STRUCTURE </code> if this method is never called * or if a connect method is called./* w w w . j a v a 2 s . c om*/ * <p> * @param structure The structure of the file (one of the FTP class * <code>_STRUCTURE</code> constants). * @return True if successfully completed, false if not. * @exception FTPConnectionClosedException * If the FTP server prematurely closes the connection as a result * of the client being idle or some other reason causing the server * to send FTP reply code 421. This exception may be caught either * as an IOException or independently as itself. * @exception IOException If an I/O error occurs while either sending a * command to the server or receiving a reply from the server. */ public boolean setFileStructure(int structure) throws IOException { if (FTPReply.isPositiveCompletion(stru(structure))) { __fileStructure = structure; return true; } return false; }
From source file:com.atomicleopard.thundr.ftp.commons.FTPClient.java
/** * Sets the transfer mode. The default transfer mode * <code> FTP.STREAM_TRANSFER_MODE </code> if this method is never called * or if a connect method is called.// ww w . ja v a 2s. c o m * <p> * @param mode The new transfer mode to use (one of the FTP class * <code>_TRANSFER_MODE</code> constants). * @return True if successfully completed, false if not. * @exception FTPConnectionClosedException * If the FTP server prematurely closes the connection as a result * of the client being idle or some other reason causing the server * to send FTP reply code 421. This exception may be caught either * as an IOException or independently as itself. * @exception IOException If an I/O error occurs while either sending a * command to the server or receiving a reply from the server. */ public boolean setFileTransferMode(int mode) throws IOException { if (FTPReply.isPositiveCompletion(mode(mode))) { __fileTransferMode = mode; return true; } return false; }