beans = Collections.singleton(root); } else { VirtualFileFilter filter = new SuffixMatchFilter("jboss-beans.xml"); beans = new ArrayList<VirtualFile>(); try {
@Override public InputStream getByteStream() { return new LazyInputStream(file); }
/** * Create a new FilterVirtualFileVisitor. * * @param filter the filter * @param attributes the attributes, uses the default if null * @throws IllegalArgumentException if the filter is null */ public FilterVirtualFileVisitor(VirtualFileFilter filter, VisitorAttributes attributes) { super(checkAttributes(filter, attributes)); this.filter = filter; }
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; }
public IncludeExcludeVisitorAttributes(Set<String> includes, Set<String> excludes) { if (includes == null) { includes = Collections.emptySet(); } if (excludes == null) { excludes = Collections.emptySet(); } this.includes = includes; this.excludes = excludes; setIncludeRoot(false); setLeavesOnly(true); setRecurseFilter(this); }
@Override public long skip(long n) throws IOException { return openStream().skip(n); }
public boolean accepts(VirtualFile file) { String string = getMatchString(file); return pattern.matcher(string).matches() == doMatch(); } }
final List<VirtualFile> childArchives = new ArrayList<VirtualFile>(virtualFile.getChildren(new SuffixMatchFilter( CHILD_ARCHIVE_EXTENSIONS, new VisitorAttributes() { @Override
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; }
@Override public synchronized void close() throws IOException { if (stream == null) { return; } openStream().close(); stream = null; // reset the stream }
public void setSuffixFilter(String suffix) { this.filter = new SuffixMatchFilter( suffix, VisitorAttributes.DEFAULT ); }
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; }
@Override public int available() throws IOException { return openStream().available(); }
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; }
@Override public int read(byte[] b) throws IOException { return openStream().read(b); }
private Path(String path) { parts = new LinkedList<String>(); List<String> tokens = PathTokenizer.getTokens(path); parts.addAll(tokens); }
@Override public void reset() throws IOException { openStream().reset(); }
@Override public int read() throws IOException { return openStream().read(); }
@Override public int read(byte[] b, int off, int len) throws IOException { return openStream().read(b, off, len); }
@Override public boolean markSupported() { try { return openStream().markSupported(); } catch (IOException e) { throw new RuntimeException(e); } } }