Package org.apache.commons.net.ftp

Examples of org.apache.commons.net.ftp.FTPClient.retrieveFile()


      }

      String filename = xmlFilePath;
      fos = new FileOutputStream(filename);
     
      client.retrieveFile(filename, fos);
      if (!FTPReply.isPositiveCompletion(client.getReplyCode())) {
        return false;
      }
      res = true;
      client.logout();
View Full Code Here


      client.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
      client.changeWorkingDirectory("Flibus");

      fos = new FileOutputStream("entryToken.txt");
      if (!client.retrieveFile("entryToken.txt", fos))
        return false;
      if (!FTPReply.isPositiveCompletion(client.getReplyCode())) {
        return false;
      }
      fos.close();
View Full Code Here

                    Boolean passiveMode = (Boolean) context.get("passiveMode");
                    boolean passive = (passiveMode == null) ? false : passiveMode.booleanValue();
                    if (passive) { ftp.enterLocalPassiveMode(); }

                    if (!ftp.retrieveFile((String) context.get("remoteFilename"), localFile)) {
                        errorList.add("File not received succesfully: " + ftp.getReplyString());
                    }
                }
                ftp.logout();
            }
View Full Code Here

            {
                OutputStream output;

                output = new FileOutputStream(local);

                ftp.retrieveFile(remote, output);

                output.close();
            }

            ftp.noop(); // check that control connection is working OK
View Full Code Here

            {
                OutputStream output;

                output = new FileOutputStream(local);

                ftp.retrieveFile(remote, output);

                output.close();
            }

            ftp.noop(); // check that control connection is working OK
View Full Code Here

        assertTrue(client1.makeDirectory("foo"));
        assertTrue(client1.makeDirectory("foo2"));
        assertTrue(client1.removeDirectory("foo2"));
        assertTrue(client1.storeFile(TEST_FILENAME, new ByteArrayInputStream(TESTDATA)));
        assertTrue(client1.storeFile(TEST_FILENAME, new ByteArrayInputStream(TESTDATA)));
        assertTrue(client1.retrieveFile(TEST_FILENAME, new ByteArrayOutputStream()));
        assertTrue(client1.deleteFile(TEST_FILENAME));
       
        assertTrue(client1.logout());
        client1.disconnect();
View Full Code Here

            try {
              FTPClient client = getFtpClient();
              File zip = new File(getFileContentService().getBaseDir() + "/" + UPDATE_ZIP_DIRECTORY + "/" + name);
              zip.createNewFile();
              FileOutputStream fos = new FileOutputStream(zip);
              client.retrieveFile(name, fos);
              fos.close();
              closeFtpClient(client);
              unThreadedUpdate(zip);
              LOGGER.info("Update complete - file : " + name + " - for timer : " + timer.getFilePrefix());
            } catch (IOException e) {
View Full Code Here

            else
            {
                OutputStream output;

                output = new FileOutputStream(local);
                ftp.retrieveFile(remote, output);
            }

            ftp.logout();
        }
        catch (FTPConnectionClosedException e)
View Full Code Here

                    Boolean passiveMode = (Boolean) context.get("passiveMode");
                    boolean passive = (passiveMode == null) ? false : passiveMode.booleanValue();
                    if (passive) { ftp.enterLocalPassiveMode(); }

                    if (!ftp.retrieveFile((String) context.get("remoteFilename"), localFile)) {
                        errorList.add("File not received succesfully: " + ftp.getReplyString());
                    }
                }
                ftp.logout();
            }
View Full Code Here

     
     
      //DEPENDS ON NAMING CONVENTION
      String filename = "ASC_Description"+ASC_ID+".xml";
      fos = new FileOutputStream(filename);
      client.retrieveFile("/uploads/ASCDs/" + filename, fos);//DEPENDS ON PATH ON FTP SERVER
    } catch (IOException e) {
     
      System.out.println("Error connecting to ftp server for retrieving ASCD....");
      e.printStackTrace();
    }finally {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.