// Extract the child names
final ArrayList<FileObject> children = new ArrayList<FileObject>();
for (@SuppressWarnings("unchecked") // OK because ChannelSftp.ls() is documented to return Vector<LsEntry>
Iterator<LsEntry> iterator = (Iterator<LsEntry>) vector.iterator(); iterator.hasNext();)
{
final LsEntry stat = iterator.next();
String name = stat.getFilename();
if (VFS.isUriStyle())
{
if (stat.getAttrs().isDir()
&& name.charAt(name.length() - 1) != '/')
{
name = name + "/";
}
}
if (name.equals(".") || name.equals("..") || name.equals("./")
|| name.equals("../"))
{
continue;
}
FileObject fo =
getFileSystem()
.resolveFile(
getFileSystem().getFileSystemManager().resolveName(
getName(), UriParser.encode(name),
NameScope.CHILD));
((SftpFileObject) FileObjectUtils.getAbstractFileObject(fo)).setStat(stat.getAttrs());
children.add(fo);
}
return children.toArray(new FileObject[children.size()]);