private Path(String path) { parts = new LinkedList<String>(); List<String> tokens = PathTokenizer.getTokens(path); parts.addAll(tokens); }
private File buildFile(File contentsDir, String name) { List<String> tokens = PathTokenizer.getTokens(name); File currentFile = contentsDir; for(String token : tokens) { currentFile = new File(currentFile, token); } currentFile.getParentFile().mkdirs(); return currentFile; }
private Path(String path) { parts = new LinkedList<String>(); List<String> tokens = PathTokenizer.getTokens(path); parts.addAll(tokens); }
private File buildFile(File contentsDir, String name) { List<String> tokens = PathTokenizer.getTokens(name); File currentFile = contentsDir; for(String token : tokens) { currentFile = new File(currentFile, token); } currentFile.getParentFile().mkdirs(); return currentFile; }
private File buildFile(File contentsDir, String name) { List<String> tokens = PathTokenizer.getTokens(name); File currentFile = contentsDir; for (String token : tokens) { currentFile = new File(currentFile, token); } currentFile.getParentFile().mkdirs(); return currentFile; }
private File buildFile(File contentsDir, String name) { List<String> tokens = PathTokenizer.getTokens(name); File currentFile = contentsDir; for(String token : tokens) { currentFile = new File(currentFile, token); } currentFile.getParentFile().mkdirs(); return currentFile; }
/** * Get the tokens that comprise this path. * * @param path the path * @return the tokens or null if the path is empty * @throws IllegalArgumentException if the path is null */ public static List<String> getTokens(String path) { if (path == null) { throw MESSAGES.nullArgument("path"); } List<String> list = new ArrayList<String>(); getTokens(list, path); return list; }
private RegistryEntry find(VirtualFile file) { return find(PathTokenizer.getTokens(file.getPathName())); }
final String name = entry.getName(); final boolean isDirectory = entry.isDirectory(); final List<String> tokens = PathTokenizer.getTokens(name); ZipNode node = rootNode; final Iterator<String> it = tokens.iterator();
final ZipEntry zipEntry = entries.nextElement(); final String name = zipEntry.getName(); final List<String> tokens = PathTokenizer.getTokens(name); final Iterator<String> it = tokens.iterator(); File current = destDir;
/** * Apply any . or .. paths in the path param. * * @param path the path * @return simple path, containing no . or .. paths */ public static String applySpecialPaths(String path) throws IllegalArgumentException { List<String> tokens = getTokens(path); if (tokens == null) { return null; } int i = 0; for (int j = 0; j < tokens.size(); j++) { String token = tokens.get(j); if (isCurrentToken(token)) { continue; } else if (isReverseToken(token)) { i--; } else { tokens.set(i++, token); } if (i < 0) { throw VFSMessages.MESSAGES.onRootPath(); } } return getRemainingPath(tokens, 0, i); }
List<String> tokens = PathTokenizer.getTokens(resourceName); Node current = rootNode;
final String name = entry.getName(); final boolean isDirectory = entry.isDirectory(); final List<String> tokens = PathTokenizer.getTokens(name); ZipNode node = rootNode; final Iterator<String> it = tokens.iterator();
final String name = entry.getName(); final boolean isDirectory = entry.isDirectory(); final List<String> tokens = PathTokenizer.getTokens(name); ZipNode node = rootNode; final Iterator<String> it = tokens.iterator();
final String name = entry.getName(); final boolean isDirectory = entry.isDirectory(); final List<String> tokens = PathTokenizer.getTokens(name); ZipNode node = rootNode; final Iterator<String> it = tokens.iterator();
/** * Get a child virtual file. The child may or may not exist in the virtual filesystem. * * @param path the path * @return the child * @throws IllegalArgumentException if the path is null */ public VirtualFile getChild(String path) { if (path == null) { throw VFSMessages.MESSAGES.nullArgument("path"); } final List<String> pathParts = PathTokenizer.getTokens(path); VirtualFile current = this; for (String part : pathParts) { if (PathTokenizer.isReverseToken(part)) { final VirtualFile parent = current.parent; current = parent == null ? current : parent; } else if (PathTokenizer.isCurrentToken(part) == false) { current = new VirtualFile(part, current); } } return current; }
public void removeCache(VirtualFile root, String path) { Node<T> node = getNode(root); if (node != null) { List<String> tokens = PathTokenizer.getTokens(path); Node<T> child = findNode(0, tokens, node); if (child != null) { Node<T> parent = child.getParent(); if (parent != null) parent.removeChild(node); else // clear root flush(); } } }