本文整理汇总了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);
}
示例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());
}
示例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);
}
}
}
示例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]);
}
示例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());
}