Package org.apache.commons.net.ftp

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


                // String root = getRoot().getName().getPath();

                Boolean userDirIsRoot = FtpFileSystemConfigBuilder.getInstance().getUserDirIsRoot(fileSystemOptions);
                if (workingDirectory != null && (userDirIsRoot == null || !userDirIsRoot.booleanValue()))
                {
                    if (!client.changeWorkingDirectory(workingDirectory))
                    {
                        throw new FileSystemException("vfs.provider.ftp/change-work-directory.error", workingDirectory);
                    }
                }
View Full Code Here


        os.close();
        client.completePendingCommand();

        if (dir != null)
        {
            if (!client.changeWorkingDirectory(dir))
            {
                throw new IllegalArgumentException("change dir to '" + dir + "' failed");
            }
        }
View Full Code Here

        try
        {
            updateLastAccessed();
          FTPClient client = getFtpClient();
          String dir = client.printWorkingDirectory();
          client.changeWorkingDirectory(relPath);
          FTPFile[] list = client.listFiles(key,null);
          client.changeWorkingDirectory(dir);
            return list;
        }
        catch (IOException e)
View Full Code Here

            updateLastAccessed();
          FTPClient client = getFtpClient();
          String dir = client.printWorkingDirectory();
          client.changeWorkingDirectory(relPath);
          FTPFile[] list = client.listFiles(key,null);
          client.changeWorkingDirectory(dir);
            return list;
        }
        catch (IOException e)
        {
            disconnect();
View Full Code Here

        catch (IOException e)
        {
            disconnect();
          FTPClient client = getFtpClient();
          String dir = client.printWorkingDirectory();
          client.changeWorkingDirectory(relPath);
          FTPFile[] list = client.listFiles(key,null);
          client.changeWorkingDirectory(dir);
            return list;
        }
        finally
View Full Code Here

            disconnect();
          FTPClient client = getFtpClient();
          String dir = client.printWorkingDirectory();
          client.changeWorkingDirectory(relPath);
          FTPFile[] list = client.listFiles(key,null);
          client.changeWorkingDirectory(dir);
            return list;
        }
        finally
        {
            updateLastAccessed();
View Full Code Here

    String keyValueSeparator = conf.get(
        "mapred.textoutputformat.separator", "\t");
    FTPClient f = new FTPClient();
    f.connect(ip, Integer.parseInt(portno));
    f.login(usr, pwd);
    f.changeWorkingDirectory(dir);
    f.setFileType(FTP.BINARY_FILE_TYPE);

    boolean isCompressed = getCompressOutput(job);
    CompressionCodec codec = null;
    String extension = "";
View Full Code Here

        os.close();
        client.completePendingCommand();

        if (dir != null)
        {
            if (!client.changeWorkingDirectory(dir))
            {
                throw new IllegalArgumentException("change dir to '" + dir + "' failed");
            }
        }
View Full Code Here

    // file
    // on the server by opening up an InputStream. As a side effect the working
    // directory on the server is changed to the parent directory of the file.
    // The FTP client connection is closed when close() is called on the
    // FSDataInputStream.
    client.changeWorkingDirectory(parent.toUri().getPath());
    InputStream is = client.retrieveFileStream(file.getName());
    FSDataInputStream fis = new FSDataInputStream(new FTPInputStream(is,
        client, statistics));
    if (!FTPReply.isPositivePreliminary(client.getReplyCode())) {
      // The ftpClient is an inconsistent state. Must close the stream
View Full Code Here

    // Change to parent directory on the server. Only then can we write to the
    // file on the server by opening up an OutputStream. As a side effect the
    // working directory on the server is changed to the parent directory of the
    // file. The FTP client connection is closed when close() is called on the
    // FSDataOutputStream.
    client.changeWorkingDirectory(parent.toUri().getPath());
    FSDataOutputStream fos = new FSDataOutputStream(client.storeFileStream(file
        .getName()), statistics) {
      @Override
      public void close() throws IOException {
        super.close();
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.