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

int net::sf::jftp::net::FtpConnection::download ( String  file  )  [inline]

Download a file or directory, block until finished.

Parameters:
file The file to download
Returns:
An int returncode

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

Definition at line 1196 of file FtpConnection.java.

References fireActionFinished(), and fireProgressUpdate().

Referenced by handleDownload().

    {
        //Log.out("ftp download started:" + this);

        int stat;

        if(file.endsWith("/"))
        {
            shortProgress = true;
            fileCount = 0;
            baseFile = file;
            dataType = DataConnection.GETDIR;

            stat = downloadDir(file);

            //pause(100);
            fireActionFinished(this);
            fireProgressUpdate(baseFile,
                               DataConnection.DFINISHED + ":" + fileCount, -1);
            shortProgress = false;
        }
        else
        {
            dataType = DataConnection.GET;

            stat = rawDownload(file);

          if(Settings.enableFtpDelays) {
             try
             {
                Thread.sleep(100);
             } catch(Exception ex) {}
          }

            fireActionFinished(this);
        }

      if(Settings.enableFtpDelays) {
         try
         {
            Thread.sleep(400);
         }
         catch(Exception ex)
         {
         }
      }

        return stat;
    }


Generated by  Doxygen 1.6.0   Back to index