/** Recursive helper method for remove() */ private long remove(StringTokenizer tokenizer) { if (tokenizer.hasMoreTokens()) { String name = tokenizer.nextToken(); FSTree child = children.get(name); if (!tokenizer.hasMoreTokens() && child != null) { children.remove(name); size -= child.size; return child.size; } else if (child != null) { long cSize = child.remove(tokenizer); size -= cSize; return cSize; } } return 0L; }
/** * Remove a node from the tree given its path relative to the file that this node represents. * * @param name The name of the file to remove. */ public void remove(String name) { StringTokenizer tokenizer = new StringTokenizer(name, "\\/"); remove(tokenizer); }