本文整理了Java中org.openide.filesystems.FileUtil.urlForArchiveOrDir()
方法的一些代码示例,展示了FileUtil.urlForArchiveOrDir()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.urlForArchiveOrDir()
方法的具体详情如下:
包路径:org.openide.filesystems.FileUtil
类名称:FileUtil
方法名:urlForArchiveOrDir
[英]Convert a file such as would be shown in a classpath entry into a proper folder URL. If the file looks to represent a directory, a file
URL will be created. If it looks to represent a ZIP archive, a jar
URL will be created.
[中]将类路径条目中显示的文件转换为正确的文件夹URL。如果文件看起来代表一个目录,将创建一个file
URL。如果它看起来代表一个ZIP存档,将创建一个jar
URL。
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-tomcat5
private static void addFileToList(List<URL> list, File f) {
URL u = FileUtil.urlForArchiveOrDir(f);
if (u != null) {
list.add(u);
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2ee-jboss4
private static void addFileToList(List<URL> list, File f) {
URL u = FileUtil.urlForArchiveOrDir(f);
if (u != null) {
list.add(u);
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-project
/**
* Creates an URL of a classpath or sourcepath root
* For the existing directory it returns the URL obtained from {@link File#toUri()}
* For archive file it returns an URL of the root of the archive file
* For non existing directory it fixes the ending '/'
* @param root the file of a root
* @param offset a path relative to the root file or null (eg. src/ for jar:file:///lib.jar!/src/)"
* @return an URL of the root
* @throws MalformedURLException if the URL cannot be created
*/
public static URL getRootURL (File root, String offset) throws MalformedURLException {
URL url = FileUtil.urlForArchiveOrDir(root);
if (offset != null) {
assert offset.endsWith("/"); //NOI18N
url = new URL(url.toExternalForm() + offset); // NOI18N
}
return url;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-ruby-railsprojects
public PublicClassPathImplementation(File projectFolder) {
List<PathResourceImplementation> list = new LinkedList<PathResourceImplementation>();
File f = PropertyUtils.resolveFile(projectFolder, "public"); // NOI18N
URL entry = FileUtil.urlForArchiveOrDir(f);
if (entry != null) {
list.add(ClassPathSupport.createResource(entry));
} else {
Logger.getLogger(PublicClassPathImplementation.class.getName()).severe(f + " does not look like a valid folder");
}
resources = Collections.unmodifiableList(list);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-ruby-railsprojects
public JavascriptsClassPathImplementation(File projectFolder) {
List<PathResourceImplementation> list = new LinkedList<PathResourceImplementation>();
File f = PropertyUtils.resolveFile(projectFolder, "public//javascripts"); // NOI18N
URL entry = FileUtil.urlForArchiveOrDir(f);
if (entry != null) {
list.add(ClassPathSupport.createResource(entry));
} else {
Logger.getLogger(PublicClassPathImplementation.class.getName()).severe(f + " does not look like a valid folder");
}
resources = Collections.unmodifiableList(list);
}
代码示例来源:origin: org.netbeans.api/org-netbeans-modules-java-source-base
@Override public synchronized URL[] getRoots() {
URL[] result = cacheRoot;
if (result == null) {
result = EMPTY;
try {
File sigs = JavaIndex.getClassFolder(originalRoot,false,scan);
URL orl = FileUtil.urlForArchiveOrDir(sigs);
if (orl != null) {
result = new URL[] {orl};
}
else {
LOG.log(Level.WARNING, "Invalid cache root: {0} exists: {1} dir: {2} retry: {3}", new Object[]{sigs.getAbsolutePath(), sigs.exists(), sigs.isDirectory(), FileUtil.urlForArchiveOrDir(sigs)}); //NOI18N
}
} catch (IOException ioe) {
Exceptions.printStackTrace(ioe);
}
cacheRoot = result;
}
assert result != null;
return result;
}
代码示例来源:origin: org.netbeans.api/org-netbeans-modules-java-source-base
private static void sources(File targetFolder, FileObject[][] sources) throws MalformedURLException {
if (sources[0] == null) {
URL targetFolderURL = FileUtil.urlForArchiveOrDir(targetFolder);
sources[0] = SourceForBinaryQuery.findSourceRoots(targetFolderURL).getRoots();
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-jsf
URL url = FileUtil.urlForArchiveOrDir(jars[i]);
if (url != null) {
urls.add(url);
urls.add(FileUtil.urlForArchiveOrDir(resource));
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2ee-jboss4
URL u = FileUtil.urlForArchiveOrDir(new File(Character.toString(dosHack)));
if (u != null) {
l.add(u);
URL u = FileUtil.urlForArchiveOrDir(new File(s));
if (u != null) {
l.add(u);
URL u = FileUtil.urlForArchiveOrDir(new File(Character.toString(dosHack)));
if (u != null) {
l.add(u);
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-tomcat5
URL u = FileUtil.urlForArchiveOrDir(new File(Character.toString(dosHack)));
if (u != null) {
l.add(u);
URL u = FileUtil.urlForArchiveOrDir(new File(s));
if (u != null) {
l.add(u);
URL u = FileUtil.urlForArchiveOrDir(new File(Character.toString(dosHack)));
if (u != null) {
l.add(u);
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javafx2-platform
@NonNull
public static List<? extends URL> getRuntimeClassPath(@NonNull final File javafxRuntime) {
Parameters.notNull("javafxRuntime", javafxRuntime); //NOI18N
final List<URL> result = new ArrayList<URL>();
final File lib = new File (javafxRuntime,"lib"); //NOI18N
final File[] children = lib.listFiles(new FileFilter() {
@Override
public boolean accept(@NonNull final File pathname) {
return pathname.getName().toLowerCase().endsWith(".jar"); //NOI18N
}
});
if (children != null) {
for (File f : children) {
final URL root = FileUtil.urlForArchiveOrDir(f);
if (root != null) {
result.add(root);
}
}
}
return result;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-project
private List<PathResourceImplementation> getPath() {
List<PathResourceImplementation> result = new ArrayList<>();
for (String p : propertyNames) {
String prop = evaluator.getProperty(p);
if (prop != null) {
for (String piece : PropertyUtils.tokenizePath(prop)) {
File f = PropertyUtils.resolveFile(projectFolder, piece);
URL entry = FileUtil.urlForArchiveOrDir(f);
if (entry != null) {
result.add(ClassPathSupport.createResource(entry));
} else {
Logger.getLogger(ProjectClassPathImplementation.class.getName()).log(Level.WARNING, "{0} does not look like a valid archive file", f);
}
}
}
}
return Collections.unmodifiableList(result);
}
}
代码示例来源:origin: org.netbeans.api/org-netbeans-modules-java-project-ui
String binrootS = tok.nextToken();
File f = FileUtil.normalizeFile(new File(binrootS));
URL binroot = FileUtil.urlForArchiveOrDir(f);
if (binroot == null) {
continue;
代码示例来源:origin: org.netbeans.api/org-netbeans-modules-java-source-base
final Predicate<Pair<File,Long>> pModified = (p) -> used == null || p.second() == -1 || used.get(p.first()) != p.second();
final Predicate<File> pNotProjDep = (f) -> {
final URL furl = FileUtil.urlForArchiveOrDir(f);
return furl == null ?
true :
代码示例来源:origin: org.netbeans.api/org-netbeans-modules-java-source-base
try {
File cacheFolder = JavaIndex.getClassFolder(sourceUrl);
URL cacheUrl = FileUtil.urlForArchiveOrDir(cacheFolder);
_cache.add(ClassPathSupport.createResource(cacheUrl));
} catch (IOException ioe) {
代码示例来源:origin: org.netbeans.api/org-netbeans-modules-java-project-ui
if (path != null) {
final File file = antProjectHelper.resolveFile(path);
final URL root = FileUtil.urlForArchiveOrDir(file);
if (root != null) {
final Collection<? extends ProfileSupport.Violation> res =
} else {
final File file = antProjectHelper.resolveFile(propName);
final URL root = FileUtil.urlForArchiveOrDir(file);
if (root != null) {
final Collection<? extends ProfileSupport.Violation> res =
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-debugger-jpda-projects
File f = new File(cp);
f = FileUtil.normalizeFile(f);
URL entry = FileUtil.urlForArchiveOrDir(f);
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javafx2-project
if(srcRoot != null) {
URL[] urls = new URL[1];
urls[0] = FileUtil.urlForArchiveOrDir(prelJarF);
FileObject[] fos = new FileObject[1];
fos[0] = FileUtil.toFileObject(prelJarF);
内容来源于网络,如有侵权,请联系作者删除!