Esempio n. 1
0
 @Override
 public Iterable<DataKey> getSubKeys() {
   final Tag tag = this.findLastTag(this.path, false);
   if (!(tag instanceof CompoundTag)) {
     return (Iterable<DataKey>) Collections.emptyList();
   }
   final List<DataKey> subKeys = (List<DataKey>) Lists.newArrayList();
   for (final String name : ((CompoundTag) tag).getValue().keySet()) {
     subKeys.add(new NBTKey(this.createRelativeKey(name)));
   }
   return subKeys;
 }
  /**
   * Finds all files in folder and in it's sub-tree of specified depth.
   *
   * @param file Starting folder
   * @param maxDepth Depth of the tree. If 1 - just look in the folder, no sub-folders.
   * @param filter file filter.
   * @return List of found files.
   */
  public static List<VisorLogFile> fileTree(File file, int maxDepth, @Nullable FileFilter filter) {
    if (file.isDirectory()) {
      File[] files = (filter == null) ? file.listFiles() : file.listFiles(filter);

      if (files == null) return Collections.emptyList();

      List<VisorLogFile> res = new ArrayList<>(files.length);

      for (File f : files) {
        if (f.isFile() && f.length() > 0) res.add(new VisorLogFile(f));
        else if (maxDepth > 1) res.addAll(fileTree(f, maxDepth - 1, filter));
      }

      return res;
    }

    return F.asList(new VisorLogFile(file));
  }
Esempio n. 3
0
 public Iterable<ZipEntry> getEntries(final String name) {
   final List<ZipEntry> entriesOfThatName = this.nameMap.get(name);
   return (entriesOfThatName != null) ? entriesOfThatName : Collections.emptyList();
 }