code: @Override
      public List<SshNode> list() throws DirectoryNotFoundException, ListException {
          List<SshNode> nodes;
          ChannelSftp.LsEntry entry;
          String name;
          boolean dir;
          ChannelSftp sftp;
  
          try {
              nodes = new ArrayList<>();
              dir = false;
              sftp = alloc();
              try {
                  for (Object obj : sftp.ls(escape(slashPath))) {
                      try {
                          entry = (ChannelSftp.LsEntry) obj;
                          name = entry.getFilename();
                          if (".".equals(name) || "..".equals(name)) {
                              dir = true;
                          } else {
                              nodes.add(join(name));
                          }
                      } catch (IllegalArgumentException e) {
                          throw new IllegalArgumentException("illegal name: " + obj, e);
                      }
                  }
                  if (!dir && nodes.size() == 1) {
                      return null;
                  } else {
                      return nodes;
                  }
              } finally {
                  free(sftp);
              }
          } catch (SftpException e) {
              if (e.id == 2) {
                  throw new DirectoryNotFoundException(this);
              }
              throw new ListException(this, e);
          } catch (JSchException e) {
              throw new ListException(this, e);
          }
      }
docs: --