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


Java FSRecords類代碼示例

本文整理匯總了Java中com.intellij.openapi.vfs.newvfs.persistent.FSRecords的典型用法代碼示例。如果您正苦於以下問題:Java FSRecords類的具體用法?Java FSRecords怎麽用?Java FSRecords使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


FSRecords類屬於com.intellij.openapi.vfs.newvfs.persistent包,在下文中一共展示了FSRecords類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: queueUnresolvedFilesSinceLastRestart

import com.intellij.openapi.vfs.newvfs.persistent.FSRecords; //導入依賴的package包/類
private void queueUnresolvedFilesSinceLastRestart() {
  PersistentFS fs = PersistentFS.getInstance();
  int maxId = FSRecords.getMaxId();
  TIntArrayList list = new TIntArrayList();
  for (int id= fileIsResolved.nextClearBit(1); id >= 0 && id < maxId; id = fileIsResolved.nextClearBit(id + 1)) {
    int nextSetBit = fileIsResolved.nextSetBit(id);
    int endOfRun = Math.min(maxId, nextSetBit == -1 ? maxId : nextSetBit);
    do {
      VirtualFile virtualFile = fs.findFileById(id);
      if (queueIfNeeded(virtualFile, myProject)) {
        list.add(id);
      }
      else {
        fileIsResolved.set(id);
      }
    }
    while (++id < endOfRun);
  }
  log("Initially added to resolve " + toVfString(list.toNativeArray()));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:RefResolveServiceImpl.java

示例2: getMirrorFile

import com.intellij.openapi.vfs.newvfs.persistent.FSRecords; //導入依賴的package包/類
private File getMirrorFile(@NotNull File originalFile) {
  if (!myFileSystem.isMakeCopyOfJar(originalFile)) return originalFile;

  final FileAttributes originalAttributes = FileSystemUtil.getAttributes(originalFile);
  if (originalAttributes == null) return originalFile;

  final String folderPath = getJarsDir();
  if (!new File(folderPath).exists() && !new File(folderPath).mkdirs()) {
    return originalFile;
  }

  if (FSRecords.weHaveContentHashes) {
    return getMirrorWithContentHash(originalFile, originalAttributes);
  }

  final String mirrorName = originalFile.getName() + "." + Integer.toHexString(originalFile.getPath().hashCode());
  final File mirrorFile = new File(folderPath, mirrorName);
  final FileAttributes mirrorAttributes = FileSystemUtil.getAttributes(mirrorFile);
  return mirrorDiffers(originalAttributes, mirrorAttributes, false) ? copyToMirror(originalFile, mirrorFile) : mirrorFile;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:JarHandler.java

示例3: processFile

import com.intellij.openapi.vfs.newvfs.persistent.FSRecords; //導入依賴的package包/類
public boolean processFile(NewVirtualFile file) {
  if (file.isDirectory() || file.is(VFileProperty.SPECIAL)) {
    return true;
  }
  try {
    DataInputStream stream = FSRecords.readContent(file.getId());
    if (stream == null) return true;
    byte[] bytes = FileUtil.loadBytes(stream);
    totalSize.addAndGet(bytes.length);
    count.incrementAndGet();
    ProgressManager.getInstance().getProgressIndicator().setText(file.getPresentableUrl());
  }
  catch (IOException e) {
    LOG.error(e);
  }
  return true;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:LoadAllVfsStoredContentsAction.java

示例4: versionDiffers

import com.intellij.openapi.vfs.newvfs.persistent.FSRecords; //導入依賴的package包/類
public static boolean versionDiffers(@NotNull File versionFile, final int currentIndexVersion) {
  try {
    ourLastStamp = Math.max(ourLastStamp, versionFile.lastModified());
    final DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(versionFile)));
    try {
      final int savedIndexVersion = DataInputOutputUtil.readINT(in);
      final int commonVersion = DataInputOutputUtil.readINT(in);
      final long vfsCreationStamp = DataInputOutputUtil.readTIME(in);
      return savedIndexVersion != currentIndexVersion ||
             commonVersion != VERSION ||
             vfsCreationStamp != FSRecords.getCreationTimestamp()
        ;

    }
    finally {
      in.close();
    }
  }
  catch (IOException e) {
    return true;
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:IndexingStamp.java

示例5: createOrGetTimeStamp

import com.intellij.openapi.vfs.newvfs.persistent.FSRecords; //導入依賴的package包/類
private static Timestamps createOrGetTimeStamp(int id) {
  boolean isValid = id > 0;
  if (!isValid) id = -id;
  Timestamps timestamps = myTimestampsCache.get(id);
  if (timestamps == null) {
    final DataInputStream stream = FSRecords.readAttributeWithLock(id, Timestamps.PERSISTENCE);
    try {
      timestamps = new Timestamps(stream);
    }
    catch (IOException e) {
      throw new RuntimeException(e);
    }
    if (isValid) myTimestampsCache.put(id, timestamps);
  }
  return timestamps;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:IndexingStamp.java

示例6: createValue

import com.intellij.openapi.vfs.newvfs.persistent.FSRecords; //導入依賴的package包/類
@NotNull
@Override
public Outputs createValue(Integer key) {
  try {
    final String dirName = FSRecords.getNames().valueOf(key);
    final File storeFile;
    if (StringUtil.isEmpty(dirName)) {
      storeFile = null;
    }
    else {
      final File compilerCacheDir = CompilerPaths.getCacheStoreDirectory(dirName);
      storeFile = compilerCacheDir.exists()? new File(compilerCacheDir, "paths_to_delete.dat") : null;
    }
    return new Outputs(storeFile, loadPathsToDelete(storeFile));
  }
  catch (IOException e) {
    LOG.info(e);
    return new Outputs(null, new HashMap<String, SourceUrlClassNamePair>());
  }
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:21,代碼來源:TranslatingCompilerFilesMonitor.java

示例7: isAssociated

import com.intellij.openapi.vfs.newvfs.persistent.FSRecords; //導入依賴的package包/類
boolean isAssociated(int projectId, String outputPath) {
  if (myProjectToOutputPathMap != null) {
    try {
      final Object val = myProjectToOutputPathMap.get(projectId);
      if (val instanceof Integer)  {
        return FileUtil.pathsEqual(outputPath, FSRecords.getNames().valueOf(((Integer)val).intValue()));
      }
      if (val instanceof TIntHashSet) {
        final int _outputPath = FSRecords.getNames().enumerate(outputPath);
        return ((TIntHashSet)val).contains(_outputPath);
      }
    }
    catch (IOException e) {
      LOG.info(e);
    }
  }
  return false;
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:19,代碼來源:TranslatingCompilerFilesMonitor.java

示例8: createValue

import com.intellij.openapi.vfs.newvfs.persistent.FSRecords; //導入依賴的package包/類
@Nonnull
@Override
public Outputs createValue(Integer key) {
  try {
    final String dirName = FSRecords.getNames().valueOf(key);
    final File storeFile;
    if (StringUtil.isEmpty(dirName)) {
      storeFile = null;
    }
    else {
      final File compilerCacheDir = CompilerPaths.getCacheStoreDirectory(dirName);
      storeFile = compilerCacheDir.exists() ? new File(compilerCacheDir, "paths_to_delete.dat") : null;
    }
    return new Outputs(storeFile, loadPathsToDelete(storeFile));
  }
  catch (IOException e) {
    LOG.info(e);
    return new Outputs(null, new HashMap<String, SourceUrlClassNamePair>());
  }
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:21,代碼來源:TranslatingCompilerFilesMonitorImpl.java

示例9: isAssociated

import com.intellij.openapi.vfs.newvfs.persistent.FSRecords; //導入依賴的package包/類
boolean isAssociated(int projectId, String outputPath) {
  if (myProjectToOutputPathMap != null) {
    try {
      final Object val = myProjectToOutputPathMap.get(projectId);
      if (val instanceof Integer) {
        return FileUtil.pathsEqual(outputPath, FSRecords.getNames().valueOf(((Integer)val).intValue()));
      }
      if (val instanceof TIntHashSet) {
        final int _outputPath = FSRecords.getNames().enumerate(outputPath);
        return ((TIntHashSet)val).contains(_outputPath);
      }
    }
    catch (IOException e) {
      LOG.info(e);
    }
  }
  return false;
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:19,代碼來源:TranslatingCompilerFilesMonitorImpl.java

示例10: getFileById

import com.intellij.openapi.vfs.newvfs.persistent.FSRecords; //導入依賴的package包/類
@Nullable
public static VirtualFileSystemEntry getFileById(int id, VirtualDirectoryImpl parent) {
  Segment segment = getSegment(id, false);
  if (segment == null) return null;

  int offset = getOffset(id);
  Object o = segment.myObjectArray.get(offset);
  if (o == null) return null;

  if (o == ourDeadMarker) {
    throw reportDeadFileAccess(new VirtualFileImpl(id, segment, parent));
  }
  final int nameId = segment.getNameId(id);
  if (nameId <= 0) {
    FSRecords.invalidateCaches();
    throw new AssertionError("nameId=" + nameId + "; data=" + o + "; parent=" + parent + "; parent.id=" + parent.getId() + "; db.parent=" + FSRecords.getParent(id));
  }

  return o instanceof DirectoryData ? new VirtualDirectoryImpl(id, segment, (DirectoryData)o, parent, parent.getFileSystem())
                                    : new VirtualFileImpl(id, segment, parent);
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:22,代碼來源:VfsData.java

示例11: getMirrorFile

import com.intellij.openapi.vfs.newvfs.persistent.FSRecords; //導入依賴的package包/類
private File getMirrorFile(@Nonnull File originalFile) {
  if (!myFileSystem.isMakeCopyOfJar(originalFile)) return originalFile;

  final FileAttributes originalAttributes = FileSystemUtil.getAttributes(originalFile);
  if (originalAttributes == null) return originalFile;

  final String folderPath = getJarsDir();
  if (!new File(folderPath).exists() && !new File(folderPath).mkdirs()) {
    return originalFile;
  }

  if (FSRecords.weHaveContentHashes) {
    return getMirrorWithContentHash(originalFile, originalAttributes);
  }

  final String mirrorName = originalFile.getName() + "." + Integer.toHexString(originalFile.getPath().hashCode());
  final File mirrorFile = new File(folderPath, mirrorName);
  final FileAttributes mirrorAttributes = FileSystemUtil.getAttributes(mirrorFile);
  return mirrorDiffers(originalAttributes, mirrorAttributes, false) ? copyToMirror(originalFile, mirrorFile) : mirrorFile;
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:21,代碼來源:JarHandler.java

示例12: processFile

import com.intellij.openapi.vfs.newvfs.persistent.FSRecords; //導入依賴的package包/類
public boolean processFile(NewVirtualFile file) {
  if (file.isDirectory() || file.is(VFileProperty.SPECIAL)) return true;
  try {
    DataInputStream stream = FSRecords.readContent(file.getId());
    if (stream == null) return true;
    byte[] bytes = FileUtil.loadBytes(stream);
    totalSize.addAndGet(bytes.length);
    count.incrementAndGet();

    ProgressManager.getInstance().getProgressIndicator().setText(file.getPresentableUrl());
  }
  catch (IOException e1) {
    LOG.error(e1);
  }
  return true;
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:17,代碼來源:LoadAllVfsStoredContentsAction.java

示例13: isIndexedStateForFile

import com.intellij.openapi.vfs.newvfs.persistent.FSRecords; //導入依賴的package包/類
@Override
public boolean isIndexedStateForFile(int fileId, @Nonnull VirtualFile file) {
  boolean indexedStateForFile = super.isIndexedStateForFile(fileId, file);
  if (!indexedStateForFile) return false;

  try {
    DataInputStream stream = FSRecords.readAttributeWithLock(fileId, VERSION_STAMP);
    int diff = stream != null ? DataInputOutputUtil.readINT(stream) : 0;
    if (diff == 0) return false;
    FileType fileType = myStubVersionMap.getFileTypeByIndexingTimestampDiff(diff);
    return fileType != null && myStubVersionMap.getStamp(file.getFileType()) == myStubVersionMap.getStamp(fileType);
  }
  catch (IOException e) {
    LOG.error(e);
    return false;
  }
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:18,代碼來源:StubUpdatingIndex.java

示例14: versionDiffers

import com.intellij.openapi.vfs.newvfs.persistent.FSRecords; //導入依賴的package包/類
public static boolean versionDiffers(@Nonnull File versionFile, final int currentIndexVersion) {
  try {
    ourLastStamp = Math.max(ourLastStamp, versionFile.lastModified());
    final DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(versionFile)));
    try {
      final int savedIndexVersion = DataInputOutputUtil.readINT(in);
      final int commonVersion = DataInputOutputUtil.readINT(in);
      final long vfsCreationStamp = DataInputOutputUtil.readTIME(in);
      return savedIndexVersion != currentIndexVersion ||
             commonVersion != VERSION ||
             vfsCreationStamp != FSRecords.getCreationTimestamp()
              ;

    }
    finally {
      in.close();
    }
  }
  catch (IOException e) {
    return true;
  }
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:23,代碼來源:IndexingStamp.java

示例15: createOrGetTimeStamp

import com.intellij.openapi.vfs.newvfs.persistent.FSRecords; //導入依賴的package包/類
private static Timestamps createOrGetTimeStamp(int id) {
  boolean isValid = id > 0;
  if (!isValid) {
    id = -id;
  }
  Timestamps timestamps = myTimestampsCache.get(id);
  if (timestamps == null) {
    final DataInputStream stream = FSRecords.readAttributeWithLock(id, Timestamps.PERSISTENCE);
    try {
      timestamps = new Timestamps(stream);
    }
    catch (IOException e) {
      throw new RuntimeException(e);
    }
    if (isValid) myTimestampsCache.put(id, timestamps);
  }
  return timestamps;
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:19,代碼來源:IndexingStamp.java


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