예제 #1
0
  @Override
  public File[] listFiles(FilenameFilter filter) {
    LinkedList<ServerFile> filtered = new LinkedList<ServerFile>();

    for (ServerFile child : children) {
      if (filter.accept(this, child.getName())) {
        filtered.add(child);
      }
    }
    return filtered.toArray(new File[0]);
  }
예제 #2
0
  @Override
  public String[] list(java.io.FilenameFilter filter) {

    LinkedList<String> names = new LinkedList<String>();
    for (ServerFile child : children) {
      if (filter == null || filter.accept(this, child.getName())) {
        names.add(child.getName());
      }
    }

    return names.toArray(new String[0]);
  };
예제 #3
0
 public void addChild(ServerFile child) {
   if (!isDirectory) {
     throw new UnsupportedOperationException("cannot add children if not a directory");
   }
   children.add(child);
   child.setParent(this);
 }