Logo Search packages:      
Sourcecode: jftp version File versions  Download package

InputStream net::sf::jftp::net::FtpConnection::getDownloadInputStream ( String  file  )  [inline]

Get download InputStream.

Parameters:
file The file to download
Returns:
An InputStream

Implements net::sf::jftp::net::BasicConnection.

Definition at line 1252 of file FtpConnection.java.

References net::sf::jftp::net::DataConnection::getInputStream(), getLocalPath(), net::sf::jftp::net::JConnection::getReader(), host, net::sf::jftp::net::DataConnection::isThere, jcon, modeStream(), pause(), net::sf::jftp::net::FtpConstants::RETR, and net::sf::jftp::net::JConnection::send().

    {
        Log.out("ftp stream download started:" + this);
        file = parse(file);

        try
        {
            int p = 0;
            dataType = DataConnection.GET;
            file = StringUtils.getFile(file);

            String path = getLocalPath() + file;

            BufferedReader in = jcon.getReader();

            modeStream();
            p = negotiatePort();

            dcon = new DataConnection(this, p, host, path, dataType, false, true);

            while(!dcon.isThere())
            {
                pause(10);
            }

            jcon.send(RETR + " " + file);

            return dcon.getInputStream();
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
            Log.debug(ex.toString() +
                      " @FtpConnection::getDownloadInputStream");

            return null;
        }
    }


Generated by  Doxygen 1.6.0   Back to index