Examples of FTPClient


Examples of htsjdk.samtools.util.ftp.FTPClient

        }
        // NOTE-- DO NOT TRY TO CLOSE STREAM.  IT WILL HANG.
    }

    public static long getContentLength(URL url) throws IOException {
        FTPClient ftp = null;
        try {
            ftp = FTPUtils.connect(url.getHost(), url.getUserInfo(), null);
            String sizeString = ftp.executeCommand("size " + url.getPath()).getReplyString();
            return Integer.parseInt(sizeString);
        } catch (Exception e) {
            return -1 ;
        }
        finally {
            if(ftp != null) {
                ftp.disconnect();
            }
        }

    }
View Full Code Here

Examples of it.sauronsoftware.ftp4j.FTPClient

            __tempResource = null;
        }
    }

    public InputStream openInputStream() throws IOException {
        final FTPClient client = this.getClient();
        if (null != client
                && client.isConnected()) {
            return this.openInputStream(this.getTempFile());
        }
        return null;
    }
View Full Code Here

Examples of net.sf.jftp.net.FtpClient

    private FtpClient client;
    private Hashtable methods = new Hashtable();

    public FtpEventHandler()
    {
        this.client = new FtpClient();

        Method[] m = this.getClass().getDeclaredMethods();
        String methodName = null;

        for(int i = 0; i < m.length; i++)
View Full Code Here

Examples of net.yacy.cora.protocol.ftp.FTPClient

   
    public InputStream getInputStream(final String userAgent, final int timeout) throws IOException {
        if (isFile()) return new FileInputStream(getFSFile());
        if (isSMB()) return new SmbFileInputStream(getSmbFile());
        if (isFTP()) {
            FTPClient client = new FTPClient();
            client.open(this.host, this.port < 0 ? 21 : this.port);
            byte[] b = client.get(this.path);
            client.CLOSE();
            return new ByteArrayInputStream(b);
        }
        if (isHTTP() || isHTTPS()) {
                final HTTPClient client = new HTTPClient();
                client.setTimout(timeout);
                client.setUserAgent(userAgent);
                client.setHost(this.getHost());
                return new ByteArrayInputStream(client.GETbytes(this));
        }
       
        return null;
    }
View Full Code Here

Examples of net.yacy.cora.protocol.ftp.FTPClient

   
    public byte[] get(final String userAgent, final int timeout) throws IOException {
        if (isFile()) return read(new FileInputStream(getFSFile()));
        if (isSMB()) return read(new SmbFileInputStream(getSmbFile()));
        if (isFTP()) {
            FTPClient client = new FTPClient();
            client.open(this.host, this.port < 0 ? 21 : this.port);
            byte[] b = client.get(this.path);
            client.CLOSE();
            return b;
        }
        if (isHTTP() || isHTTPS()) {
                final HTTPClient client = new HTTPClient();
                client.setTimout(timeout);
                client.setUserAgent(userAgent);
                client.setHost(this.getHost());
                return client.GETbytes(this);
        }
       
        return null;
    }
View Full Code Here

Examples of net.yacy.cora.protocol.ftp.FTPClient

                    Access access = this.service.getProtocol() == Protocol.http || this.service.getProtocol() == Protocol.https ? Access.granted : Access.unknown;
                    services.put(service, access);
                    if (access == Access.unknown) {
                        // ask the service if it lets us in
                        if (this.service.getProtocol() == Protocol.ftp) {
                            final FTPClient ftpClient = new FTPClient();
                            try {
                                ftpClient.open(this.service.getInetAddress().getHostAddress(), this.service.getProtocol().port);
                                ftpClient.login("anonymous", "anomic@");
                                List<String> list = ftpClient.list("/", false);
                                ftpClient.CLOSE();
                                access = list == null || list.isEmpty() ? Access.empty : Access.granted;
                            } catch (IOException e) {
                                access = Access.denied;
                            }
                        }
View Full Code Here

Examples of net.yacy.cora.protocol.ftp.FTPClient

        // stream for ftp-client errors
        final ByteArrayOutputStream berr = new ByteArrayOutputStream();

        // create new ftp client
        final FTPClient ftpClient = new FTPClient();
       
        // get a connection
        if (openConnection(ftpClient, entryUrl)) {
            // test if the specified file is a directory
            if (file.length() > 0) {
                ftpClient.exec("cd \"" + path + "\"", false);

                final boolean isFolder = ftpClient.isFolder(file);
                if (isFolder) {
                    path = fullPath + "/";
                    file = "";
                }
            }

            if (file.length() == 0) {
                // directory -> get list of files
                RequestHeader requestHeader = new RequestHeader();
                if (request.referrerhash() != null) {
                    DigestURI u = sb.getURL(Segments.Process.LOCALCRAWLING, request.referrerhash());
                    if (u != null) requestHeader.put(RequestHeader.REFERER, u.toNormalform(true, false));
                }
               
                StringBuilder dirList = ftpClient.dirhtml(path);

                if (dirList == null) {
                    response = null;
                } else {
                    ResponseHeader responseHeader = new ResponseHeader();
View Full Code Here

Examples of org.apache.commons.net.ftp.FTPClient

        // ignore
      }
    }
   
    // Connect to the server
       mFTPClient = new FTPClient();
       try {
         mFTPClient.connect(mServerUrl, mPort);
         mLog.fine("Connected to " + mServerUrl + ":" + mPort);
         mFTPClient.setSoTimeout(30000);
         checkReplyCode();
View Full Code Here

Examples of org.apache.commons.net.ftp.FTPClient

        this.user = (String) workItem.getParameter("User");
        this.password = (String) workItem.getParameter("Password");
        this.filePath = (String) workItem.getParameter("FilePath");
       
        client = new FTPClient();
        try {
            if(connection != null){
                client.connect(connection.getHost(), Integer.parseInt(connection.getPort()));
                int reply = client.getReplyCode();
View Full Code Here

Examples of org.apache.commons.net.ftp.FTPClient

        }
    }
   
    @Override
    protected FTPClient createFTPClient() throws Exception {
        FTPClient client = new MyFTPClient();
        client.setDefaultTimeout(10000);
        return client;
    }
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.