Package com.jcraft.jsch

Examples of com.jcraft.jsch.ChannelSftp.ls()


    }

    public List list(String parent) throws IOException {
        try {
            ChannelSftp c = getSftpChannel(parent);
            Collection r = c.ls(parent);
            if (r != null) {
                if (!parent.endsWith("/")) {
                    parent = parent + "/";
                }
                List result = new ArrayList();
View Full Code Here


     */
    public Resource resolveResource(String path) {
        try {
            ChannelSftp c = getSftpChannel(path);

            Collection r = c.ls(getPath(path));

            if (r != null) {
                for (Iterator iter = r.iterator(); iter.hasNext();) {
                    Object obj = iter.next();
                    if (obj instanceof LsEntry) {
View Full Code Here

    }

    public List list(String parent) throws IOException {
        try {
            ChannelSftp c = getSftpChannel(parent);
            Collection r = c.ls(parent);
            if (r != null) {
                if (!parent.endsWith("/")) {
                    parent = parent + "/";
                }
                List result = new ArrayList();
View Full Code Here

     */
    public Resource resolveResource(String path) {
        try {
            ChannelSftp c = getSftpChannel(path);

            Collection r = c.ls(getPath(path));

            if (r != null) {
                for (Iterator iter = r.iterator(); iter.hasNext();) {
                    Object obj = iter.next();
                    if (obj instanceof LsEntry) {
View Full Code Here

    public List list(String parent) throws IOException {
        try {
            ChannelSftp c = getSftpChannel(parent);
            String path = getPath(parent);
            Collection r = c.ls(path);
            if (r != null) {
                if (!path.endsWith("/")) {
                    path = parent + "/";
                }
                List result = new ArrayList();
View Full Code Here

        SftpClient client = new SftpClient("local");
        Field channelField = client.getClass().getDeclaredField("channelSftp");
        channelField.setAccessible(true);

        ChannelSftp mockChannel = mock(ChannelSftp.class);
        when(mockChannel.ls(anyString())).thenThrow(exceptionToThrow);
        channelField.set(client, mockChannel);

        return client;
    }
View Full Code Here

    @Test
    public void testReadDir() throws Exception {
        ChannelSftp c = (ChannelSftp) session.openChannel("sftp");
        c.connect();
        Vector res = c.ls("target/classes/org/apache/sshd/");
        for (Object f : res) {
            System.out.println(f.toString());
        }
    }
View Full Code Here

    @Test
    public void testReadDir() throws Exception {
        ChannelSftp c = (ChannelSftp) session.openChannel("sftp");
        c.connect();
        Vector res = c.ls("target/classes/org/apache/sshd/");
        for (Object f : res) {
            System.out.println(f.toString());
        }
    }
View Full Code Here

        final ChannelSftp channel = getAbstractFileSystem().getChannel();

        try
        {
            // try the direct way to list the directory on the server to avoid too many roundtrips
            vector = channel.ls(relPath);
        }
        catch (final SftpException e)
        {
            String workingDirectory = null;
            try
View Full Code Here

            }

            SftpException lsEx = null;
            try
            {
                vector = channel.ls(".");
            }
            catch (final SftpException ex)
            {
                lsEx = ex;
            }
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.