當前位置: 首頁>>代碼示例>>Java>>正文


Java FileUtil.isArchiveArtifact方法代碼示例

本文整理匯總了Java中org.openide.filesystems.FileUtil.isArchiveArtifact方法的典型用法代碼示例。如果您正苦於以下問題:Java FileUtil.isArchiveArtifact方法的具體用法?Java FileUtil.isArchiveArtifact怎麽用?Java FileUtil.isArchiveArtifact使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.openide.filesystems.FileUtil的用法示例。


在下文中一共展示了FileUtil.isArchiveArtifact方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: filterArtefact

import org.openide.filesystems.FileUtil; //導入方法依賴的package包/類
private static Collection<? extends URL> filterArtefact(
        final boolean archive,
        @NonNull final URL... urls) {
    final Collection<URL> res = new ArrayList<>(urls.length);
    for (URL url : urls) {
        if ((archive && FileUtil.isArchiveArtifact(url)) ||
            (!archive && !FileUtil.isArchiveArtifact(url))) {
            res.add(url);
            break;
        }
    }
    if (res.isEmpty()) {
        Collections.addAll(res, urls);
    }
    return res;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:ModuleClassPaths.java

示例2: apply

import org.openide.filesystems.FileUtil; //導入方法依賴的package包/類
@Override
public Boolean apply(@NonNull final URL url) {
    final URL aurl = FileUtil.isArchiveArtifact(url) ?
            FileUtil.getArchiveFile(url) :
            url;
    if (Optional.ofNullable(includeProp)
            .map((p) -> getDir(p))
            .map((fo) -> Objects.equals(fo.toURL(),aurl))
            .orElse(Boolean.FALSE)) {
        return Boolean.TRUE;
    }            
    if(Optional.ofNullable(excludeProp)
            .map((p) -> getDir(p))
            .map((fo) -> Objects.equals(fo.toURL(),aurl))
            .orElse(Boolean.FALSE)) {
        return Boolean.FALSE;
    }
    return null;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:ClassPathProviderImpl.java

示例3: findSourceRoots2

import org.openide.filesystems.FileUtil; //導入方法依賴的package包/類
@Override
public Result findSourceRoots2(@NonNull URL binaryRoot) {
    boolean archive = false;
    if (FileUtil.isArchiveArtifact(binaryRoot)) {
        binaryRoot = FileUtil.getArchiveFile(binaryRoot);
        archive = true;
    }
    R res = null;
    try {
        URI artefact = binaryRoot.toURI();
        res = cache.get(artefact);
        if (res == null) {
            res = createResult(artefact, archive, modules, binaryProperties);
            if (res == null) {
                res = createResult(artefact, archive, testModules, testBinaryProperties);
            }
            R prev = cache.get(artefact);
            if (prev != null) {
                res = prev;
            } else if (res != null) {
                prev = cache.putIfAbsent(artefact, res);
                if (prev != null) {
                    res = prev;
                }
            }
        }
    } catch (URISyntaxException e) {
        LOG.log(
                Level.WARNING,
                "Invalid URI: {0}", //NOI18N
                binaryRoot.toExternalForm());
    }
    return res;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:35,代碼來源:MultiModuleSourceForBinaryQueryImpl.java

示例4: findJavadoc

import org.openide.filesystems.FileUtil; //導入方法依賴的package包/類
@Override
public JavadocForBinaryQuery.Result findJavadoc(URL binaryRoot) {
    boolean archive = false;
    if (FileUtil.isArchiveArtifact(binaryRoot)) {
        binaryRoot = FileUtil.getArchiveFile(binaryRoot);
        archive = true;
    }
    R res = null;
    try {
        URI artefact = binaryRoot.toURI();
        res = cache.get(artefact);
        if (res == null) {
            res = createResult(artefact, archive, modules, binaryProperties);
            R prev = cache.get(artefact);
            if (prev != null) {
                res = prev;
            } else if (res != null) {
                prev = cache.putIfAbsent(artefact, res);
                if (prev != null) {
                    res = prev;
                }
            }
        }
    } catch (URISyntaxException e) {
        LOG.log(
                Level.WARNING,
                "Invalid URI: {0}", //NOI18N
                binaryRoot.toExternalForm());
    }
    return res;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:32,代碼來源:MultiModuleJavadocForBinaryQueryImpl.java

示例5: removeArchives

import org.openide.filesystems.FileUtil; //導入方法依賴的package包/類
private static URL[] removeArchives(@NonNull final URL... orig) {
    final List<URL> res = new ArrayList<>(orig.length);
    for (URL url : orig) {
        if (!FileUtil.isArchiveArtifact(url)) {
            res.add(url);
        }
    }
    return res.isEmpty() ?
            orig :
            res.toArray(new URL[res.size()]);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:ProjectRunnerImpl.java

示例6: getOwner

import org.openide.filesystems.FileUtil; //導入方法依賴的package包/類
/**
 * Find the project, if any, which "owns" the given URI.
 * @param uri the URI to the file (generally on disk); must be absolute and not opaque (though {@code jar}-protocol URIs are unwrapped as a convenience)
 * @return a project which contains it, or null if there is no known project containing it
 * @throws IllegalArgumentException if the URI is relative or opaque
 */
public static Project getOwner(URI uri) {
    try {
        URL url = uri.toURL();
        if (FileUtil.isArchiveArtifact(url)) {
            url = FileUtil.getArchiveFile(url);
            if (url != null) {
                uri = url.toURI();
            }
        }
    } catch (MalformedURLException | URISyntaxException e) {
        LOG.log(Level.INFO, null, e);
    }
    if (!uri.isAbsolute() || uri.isOpaque()) {
        throw new IllegalArgumentException("Bad URI: " + uri); // NOI18N
    }
    for (FileOwnerQueryImplementation q : getInstances()) {
        Project p = q.getOwner(uri);
        if (p != null) {
            if (LOG.isLoggable(Level.FINE)) {
                LOG.log(Level.FINE, "getOwner({0}) -> {1} from {2}", new Object[] {uri, p, q});
            }
            return p == UNOWNED ? null : p;
        }
    }
    LOG.log(Level.FINE, "getOwner({0}) -> nil", uri);
    return null;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:34,代碼來源:FileOwnerQuery.java

示例7: findProjectRoots

import org.openide.filesystems.FileUtil; //導入方法依賴的package包/類
public static FileObject findProjectRoots(Project project, List<URL> urls) {
    if (project == null) {
        return null;
    }
    FileObject ret = null;
    Set<URL> knownURLs = new HashSet<>();
    for (SourceGroup sg : org.netbeans.api.project.ProjectUtils.getSources(project).getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA)) {
        if (org.netbeans.modules.jshell.project.ShellProjectUtils.isNormalRoot(sg)) {
            if (urls != null) {
                URL u = URLMapper.findURL(sg.getRootFolder(), URLMapper.INTERNAL);
                BinaryForSourceQuery.Result r = BinaryForSourceQuery.findBinaryRoots(u);
                for (URL ru : r.getRoots()) {
                    // ignore JARs, prefer output folder:
                    if (FileUtil.isArchiveArtifact(ru)) {
                        continue;
                    }
                    if (knownURLs.add(ru)) {
                        urls.add(ru);
                    }
                }
            }
            if (ret == null) {
                ret = sg.getRootFolder();
            }
        }
    }
    return ret;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:29,代碼來源:ShellProjectUtils.java


注:本文中的org.openide.filesystems.FileUtil.isArchiveArtifact方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。