}
public String[] list(File directory, FilenameFilter filter) throws IOException {
final FSEntry entry = NTFSfs.getRootEntry();
if (entry == null) {
throw new FileNotFoundException(directory.getAbsolutePath());
}
if (!entry.isDirectory()) {
throw new IOException("Cannot list on non-directories " + directory);
}
final ArrayList<String> list = new ArrayList<String>();
for (Iterator<? extends FSEntry> i = entry.getDirectory().iterator(); i.hasNext();) {
final FSEntry child = i.next();
final String name = child.getName();
if ((filter == null) || (filter.accept(directory, name))) {
list.add(name);
}
if (child.isDirectory())
child.getDirectory();
else
child.getFile();
if (child.isFile())
System.out.println(
"Name = \"" + name + "\" , Size = " + child.getFile().getLength() + ", IsDirectory = " +
child.isDirectory());
else
System.out.println(
"Name = \"" + name + "\" , IsDirectory = " + child.isDirectory());
}
return list.toArray(new String[list.size()]);
}