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


Java ArchiveFileSystemBase類代碼示例

本文整理匯總了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);
  }
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:24,代碼來源:ArchiveNewVirtualFile.java

示例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;
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:15,代碼來源:CompilerServerManagingFSImpl.java

示例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);
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:8,代碼來源:VfsImplUtil.java

示例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;
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:80,代碼來源:PersistentFSImpl.java

示例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;
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:7,代碼來源:PersistentFSImpl.java

示例6: JarHandler

import consulo.vfs.impl.archive.ArchiveFileSystemBase; //導入依賴的package包/類
public JarHandler(@Nonnull String path, @Nonnull ArchiveFileSystemBase fileSystem) {
  super(path);
  myFileSystem = fileSystem;
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:5,代碼來源:JarHandler.java


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