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