当前位置: 首页>>代码示例>>Java>>正文


Java FileObject.toURI方法代码示例

本文整理汇总了Java中org.openide.filesystems.FileObject.toURI方法的典型用法代码示例。如果您正苦于以下问题:Java FileObject.toURI方法的具体用法?Java FileObject.toURI怎么用?Java FileObject.toURI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openide.filesystems.FileObject的用法示例。


在下文中一共展示了FileObject.toURI方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRootURIs

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
@NonNull
@Override
protected List<? extends URI> getRootURIs() {
    final List<URI> result = new ArrayList<>(roots.length);
    for (FileObject root : roots) {
        final URI uri = root.toURI();
        if (uri != null) {
            result.add(uri);
        } else {
            LOG.log(
                Level.WARNING,
                "Cannot convert: {0} to URI.",  //NOI18N
                FileUtil.getFileDisplayName(root));
        }
    }
    return Collections.unmodifiableList(result);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:QueriesCache.java

示例2: createKey

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
@CheckForNull
Key createKey(@NonNull final URL rootURL) {
    final URL fileURL = FileUtil.getArchiveFile(rootURL);
    if (fileURL == null) {
        //Not an archive
        return null;
    }
    final FileObject fileFo = URLMapper.findFileObject(fileURL);
    if (fileFo == null) {
        return null;
    }
    return new Key(
        fileFo.toURI(),
        fileFo.lastModified().getTime(),
        fileFo.getSize());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:ProfileSupport.java

示例3: markExternalOwnerTransient

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
/** @see FileOwnerQuery#markExternalOwner */
public static void markExternalOwnerTransient(URI root, Project owner) {
    externalRootsIncludeNonFolders |= !root.getPath().endsWith("/");
    if (owner != null) {
        FileObject fo = owner.getProjectDirectory();
        URI foUri = owner == FileOwnerQuery.UNOWNED ? UNOWNED_URI : fo.toURI();
        synchronized (cacheLock) {
            cacheInvalid = true;
            externalOwners.put(root, foUri);
            deserializedExternalOwners.remove(root);
        }
    } else {
        synchronized (cacheLock) {
            cacheInvalid = true;
            externalOwners.remove(root);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:SimpleFileOwnerQueryImplementation.java

示例4: hasRoot

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
private static boolean hasRoot(
        @NonNull final Set<URI> extRoots,
        @NonNull final FileObject file,
        final boolean folder,
        @NonNull final URI[] furi) {
    if (extRoots.isEmpty() || !(folder || externalRootsIncludeNonFolders)) {
        return false;
    }
    furi[0] = file.toURI();
    return extRoots.contains(furi[0]);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:SimpleFileOwnerQueryImplementation.java

示例5: testRegularURI

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
/**
 * Checks that file with just regular characters in name is translated OK
 * @throws Exception 
 */
public void testRegularURI() throws Exception {
    
    FileObject fo = FileUtil.getConfigRoot();
    
    FileObject origDir = fo.createFolder("origFolder");
    FileObject newFile = origDir.createData("regularFileName.txt");
    
    final FileObject d = fo.createFolder("subfolder");
    OutputStream ostm = d.createAndOpen("regularShadowURI.shadow");
    BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(ostm));
    
    URI uri = newFile.toURI();
    String urlString = newFile.toURI().toString();
    bw.write(urlString + ".old");
    bw.newLine();
    bw.newLine();
    bw.close();
    
    FileObject fob = d.getFileObject("regularShadowURI.shadow");
    DataObject dd = DataObject.find(fob);
    
    assertTrue("Shadow must be translated, not broken", dd instanceof DataShadow);
    
    DataShadow ds = (DataShadow)dd;
    assertEquals("Shadow's original must be on the translated location", newFile, ds.getOriginal().getPrimaryFile());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:DataShadowTranslateTest.java


注:本文中的org.openide.filesystems.FileObject.toURI方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。