本文整理汇总了Java中consulo.vfs.impl.archive.ArchiveFileSystemBase类的典型用法代码示例。如果您正苦于以下问题:Java ArchiveFileSystemBase类的具体用法?Java ArchiveFileSystemBase怎么用?Java ArchiveFileSystemBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ArchiveFileSystemBase类属于consulo.vfs.impl.archive包,在下文中一共展示了ArchiveFileSystemBase类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ArchiveNewVirtualFile
import consulo.vfs.impl.archive.ArchiveFileSystemBase; //导入依赖的package包/类
public ArchiveNewVirtualFile(VirtualFile parent, ArchiveFileSystemBase fileSystem) {
myParent = parent;
myFileSystem = fileSystem;
try {
ArchiveFile jarFile = fileSystem.createArchiveFile(myParent.getPath());
Iterator<? extends ArchiveEntry> entries = jarFile.entries();
while (entries.hasNext()) {
ArchiveEntry next = entries.next();
String name = next.getName();
if (!next.isDirectory()) {
createFile(name, jarFile, next);
}
}
}
catch (IOException e) {
throw new Error(e);
}
}
示例2: findRoot
import consulo.vfs.impl.archive.ArchiveFileSystemBase; //导入依赖的package包/类
@Nullable
@Override
public NewVirtualFile findRoot(@Nonnull String basePath, @Nonnull NewVirtualFileSystem fs) {
String p = PathUtil.toPresentableUrl(basePath);
VirtualFile fileByPath = LocalFileSystem.getInstance().findFileByPath(p);
if (fileByPath != null) {
if (fs instanceof ArchiveFileSystem) {
return new ArchiveNewVirtualFile(fileByPath, (ArchiveFileSystemBase) fs);
}
return new CompilerServerNewVirtualFileImpl(fileByPath, fs);
}
return null;
}
示例3: getHandler
import consulo.vfs.impl.archive.ArchiveFileSystemBase; //导入依赖的package包/类
@Nonnull
public static <T extends ArchiveHandler> T getHandler(@Nonnull ArchiveFileSystem vfs,
@Nonnull VirtualFile entryFile,
@Nonnull PairFunction<String, ArchiveFileSystemBase, T> producer) {
String localPath = vfs.extractLocalPath(vfs.extractRootPath(entryFile.getPath()));
return getHandler(vfs, localPath, producer);
}
示例4: findRoot
import consulo.vfs.impl.archive.ArchiveFileSystemBase; //导入依赖的package包/类
@Override
@Nullable
public VirtualFileSystemEntry findRoot(@Nonnull final String basePath, @Nonnull NewVirtualFileSystem fs) {
if (basePath.isEmpty()) {
LOG.error("Invalid root, fs=" + fs);
return null;
}
String rootUrl = normalizeRootUrl(basePath, fs);
VirtualFileSystemEntry root = myRoots.get(rootUrl);
if (root != null) return root;
String rootName;
if (fs instanceof ArchiveFileSystemBase) {
VirtualFile localFile = findLocalByRootPath(basePath, (ArchiveFileSystemBase)fs);
if (localFile == null) return null;
rootName = localFile.getName();
}
else {
rootName = basePath;
}
FileAttributes attributes = fs.getAttributes(new StubVirtualFile() {
@Nonnull
@Override
public String getPath() {
return basePath;
}
@Nullable
@Override
public VirtualFile getParent() {
return null;
}
});
if (attributes == null || !attributes.isDirectory()) {
return null;
}
int rootId = FSRecords.findRootRecord(rootUrl);
VfsData.Segment segment = VfsData.getSegment(rootId, true);
VfsData.DirectoryData directoryData = new VfsData.DirectoryData();
VirtualFileSystemEntry newRoot = new FsRoot(rootId, segment, directoryData, fs, rootName, StringUtil.trimEnd(basePath, "/"));
boolean mark;
synchronized (myRoots) {
root = myRoots.get(rootUrl);
if (root != null) return root;
try {
VfsData.initFile(rootId, segment, -1, directoryData);
}
catch (VfsData.FileAlreadyCreatedException e) {
for (Map.Entry<String, VirtualFileSystemEntry> entry : myRoots.entrySet()) {
final VirtualFileSystemEntry existingRoot = entry.getValue();
if (Math.abs(existingRoot.getId()) == rootId) {
throw new RuntimeException("Duplicate FS roots: " + rootUrl + " and " + entry.getKey() + ", id=" + rootId + ", valid=" + existingRoot.isValid(), e);
}
}
throw new RuntimeException("No root duplication, roots=" + Arrays.toString(FSRecords.listAll(1)), e);
}
incStructuralModificationCount();
mark = writeAttributesToRecord(rootId, 0, newRoot, fs, attributes);
myRoots.put(rootUrl, newRoot);
myRootsById.put(rootId, newRoot);
myIdToDirCache.put(rootId, newRoot);
}
if (!mark && attributes.lastModified != FSRecords.getTimestamp(rootId)) {
newRoot.markDirtyRecursively();
}
LOG.assertTrue(rootId == newRoot.getId(), "root=" + newRoot + " expected=" + rootId + " actual=" + newRoot.getId());
return newRoot;
}
示例5: findLocalByRootPath
import consulo.vfs.impl.archive.ArchiveFileSystemBase; //导入依赖的package包/类
@Nullable
public static VirtualFile findLocalByRootPath(@Nonnull String rootPath, @Nonnull ArchiveFileSystemBase fileSystem) {
String localPath = StringUtil.trimEnd(rootPath, URLUtil.ARCHIVE_SEPARATOR);
VirtualFile local = StandardFileSystems.local().findFileByPath(localPath);
return local != null && fileSystem.isMyFile(local) ? local : null;
}
示例6: JarHandler
import consulo.vfs.impl.archive.ArchiveFileSystemBase; //导入依赖的package包/类
public JarHandler(@Nonnull String path, @Nonnull ArchiveFileSystemBase fileSystem) {
super(path);
myFileSystem = fileSystem;
}