Example usage for org.apache.commons.net.ftp FTPCmd STOU

List of usage examples for org.apache.commons.net.ftp FTPCmd STOU

Introduction

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

Prototype

FTPCmd STOU

To view the source code for org.apache.commons.net.ftp FTPCmd STOU.

Click Source Link

Usage

From source file:com.atomicleopard.thundr.ftp.commons.FTP.java

/***
 * A convenience method to send the FTP STOU command to the server,
 * receive the reply, and return the reply code.  Remember, it is up
 * to you to manage the data connection.  If you don't need this low
 * level of access, use {@link org.apache.commons.net.ftp.FTPClient}
 * , which will handle all low level details for you.
 * <p>//from  w  w w  .  j  a  va2  s .  c  o  m
 * @return The reply code received from the server.
 * @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 the
 *      command or receiving the server reply.
 ***/
public int stou() throws IOException {
    return sendCommand(FTPCmd.STOU);
}

From source file:com.atomicleopard.thundr.ftp.commons.FTP.java

/***
 * A convenience method to send the FTP STOU command to the server,
 * receive the reply, and return the reply code.  Remember, it is up
 * to you to manage the data connection.  If you don't need this low
 * level of access, use {@link org.apache.commons.net.ftp.FTPClient}
 * , which will handle all low level details for you.
 * @param pathname  The base pathname to use for the file when stored at
 *                  the remote end of the transfer.  Some FTP servers
 *                  require this.//  ww w . ja  va  2 s.co  m
 * @return The reply code received from the server.
 * @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 the
 *      command or receiving the server reply.
 */
public int stou(String pathname) throws IOException {
    return sendCommand(FTPCmd.STOU, pathname);
}

From source file:com.atomicleopard.thundr.ftp.commons.FTPClient.java

/**
 * Stores a file on the server using a unique name derived from the
 * given name and taking input/*w w  w.j  a va2  s .c  om*/
 * from the given InputStream.  This method does NOT close the given
 * InputStream.  If the current file type is ASCII, line separators in
 * the file are transparently converted to the NETASCII format (i.e.,
 * you should not attempt to create a special InputStream to do this).
 * <p>
 * @param remote  The name on which to base the unique name given to
 *                the remote file.
 * @param local   The local InputStream from which to read the 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 org.apache.commons.net.io.CopyStreamException
 *      If an I/O error occurs while actually
 *      transferring the file.  The CopyStreamException allows you to
 *      determine the number of bytes transferred and the IOException
 *      causing the error.  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 storeUniqueFile(String remote, InputStream local) throws IOException {
    return __storeFile(FTPCmd.STOU, remote, local);
}

From source file:com.atomicleopard.thundr.ftp.commons.FTPClient.java

/**
 * Returns an OutputStream through which data can be written to store
 * a file on the server using a unique name derived from the given name.
 * If the current file type/* w ww  . j  a va  2 s . com*/
 * is ASCII, the returned OutputStream will convert line separators in
 * the file to the NETASCII format  (i.e., you should not attempt to
 * create a special OutputStream to do this).  You must close the
 * OutputStream when you finish writing to it.  The OutputStream itself
 * will take care of closing the parent data connection socket upon being
 * closed.  To finalize the file transfer you must call
 * {@link #completePendingCommand  completePendingCommand } and
 * check its return value to verify success.
 * <p>
 * @param remote  The name on which to base the unique name given to
 *                the remote file.
 * @return An OutputStream through which the remote file can be written.  If
 *      the data connection cannot be opened (e.g., the file does not
 *      exist), null is returned (in which case you may check the reply
 *      code to determine the exact reason for failure).
 * @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 OutputStream storeUniqueFileStream(String remote) throws IOException {
    return __storeFileStream(FTPCmd.STOU, remote);
}

From source file:com.atomicleopard.thundr.ftp.commons.FTPClient.java

/**
 * Stores a file on the server using a unique name assigned by the
 * server and taking input from the given InputStream.  This method does
 * NOT close the given//w  ww .j  av a  2 s  .  co  m
 * InputStream.  If the current file type is ASCII, line separators in
 * the file are transparently converted to the NETASCII format (i.e.,
 * you should not attempt to create a special InputStream to do this).
 * <p>
 * @param local   The local InputStream from which to read the 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 org.apache.commons.net.io.CopyStreamException
 *      If an I/O error occurs while actually
 *      transferring the file.  The CopyStreamException allows you to
 *      determine the number of bytes transferred and the IOException
 *      causing the error.  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 storeUniqueFile(InputStream local) throws IOException {
    return __storeFile(FTPCmd.STOU, null, local);
}

From source file:com.atomicleopard.thundr.ftp.commons.FTPClient.java

/**
 * Returns an OutputStream through which data can be written to store
 * a file on the server using a unique name assigned by the server.
 * If the current file type/*from w  ww . j  a  v  a 2 s  .  co m*/
 * is ASCII, the returned OutputStream will convert line separators in
 * the file to the NETASCII format  (i.e., you should not attempt to
 * create a special OutputStream to do this).  You must close the
 * OutputStream when you finish writing to it.  The OutputStream itself
 * will take care of closing the parent data connection socket upon being
 * closed.  To finalize the file transfer you must call
 * {@link #completePendingCommand  completePendingCommand } and
 * check its return value to verify success.
 * <p>
 * @return An OutputStream through which the remote file can be written.  If
 *      the data connection cannot be opened (e.g., the file does not
 *      exist), null is returned (in which case you may check the reply
 *      code to determine the exact reason for failure).
 * @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 OutputStream storeUniqueFileStream() throws IOException {
    return __storeFileStream(FTPCmd.STOU, null);
}