当前位置: 首页>>代码示例>>Java>>正文


Java DataInputOutputUtil.readINT方法代码示例

本文整理汇总了Java中com.intellij.util.io.DataInputOutputUtil.readINT方法的典型用法代码示例。如果您正苦于以下问题:Java DataInputOutputUtil.readINT方法的具体用法?Java DataInputOutputUtil.readINT怎么用?Java DataInputOutputUtil.readINT使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.util.io.DataInputOutputUtil的用法示例。


在下文中一共展示了DataInputOutputUtil.readINT方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: versionDiffers

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的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

示例2: ClassRepr

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的package包/类
public ClassRepr(final DependencyContext context, final DataInput in) {
  super(in);
  try {
    this.myContext = context;
    myFileName = DataInputOutputUtil.readINT(in);
    mySuperClass = (TypeRepr.ClassType)TypeRepr.externalizer(context).read(in);
    myInterfaces = (Set<TypeRepr.AbstractType>)RW.read(TypeRepr.externalizer(context), new THashSet<TypeRepr.AbstractType>(1), in);
    myFields = (Set<FieldRepr>)RW.read(FieldRepr.externalizer(context), new THashSet<FieldRepr>(), in);
    myMethods = (Set<MethodRepr>)RW.read(MethodRepr.externalizer(context), new THashSet<MethodRepr>(), in);
    myAnnotationTargets = (Set<ElemType>)RW.read(UsageRepr.AnnotationUsage.elementTypeExternalizer, EnumSet.noneOf(ElemType.class), in);

    final String s = RW.readUTF(in);

    myRetentionPolicy = s.length() == 0 ? null : RetentionPolicy.valueOf(s);

    myOuterClassName = DataInputOutputUtil.readINT(in);
    int flags = DataInputOutputUtil.readINT(in);
    myIsLocal = (flags & LOCAL_MASK) != 0;
    myIsAnonymous = (flags & ANONYMOUS_MASK) != 0;
    myUsages =(Set<UsageRepr.Usage>)RW.read(UsageRepr.externalizer(context), new THashSet<UsageRepr.Usage>(), in);
  }
  catch (IOException e) {
    throw new BuildDataCorruptedException(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ClassRepr.java

示例3: SerializedStubTree

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的package包/类
public SerializedStubTree(DataInput in) throws IOException {
  if (PersistentHashMapValueStorage.COMPRESSION_ENABLED) {
    int serializedStubsLength = DataInputOutputUtil.readINT(in);
    byte[] bytes = new byte[serializedStubsLength];
    in.readFully(bytes);
    myBytes = bytes;
    myLength = myBytes.length;
    myByteContentLength = DataInputOutputUtil.readLONG(in);
    myCharContentLength = DataInputOutputUtil.readINT(in);
  } else {
    myBytes = CompressionUtil.readCompressed(in);
    myLength = myBytes.length;
    myByteContentLength = in.readLong();
    myCharContentLength = in.readInt();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:SerializedStubTree.java

示例4: readChange

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的package包/类
public static Change readChange(DataInput in) throws IOException {
  int type = DataInputOutputUtil.readINT(in);
  switch (type) {
    case 1:
      return new CreateFileChange(in);
    case 2:
      return new CreateDirectoryChange(in);
    case 3:
      return new ContentChange(in);
    case 4:
      return new RenameChange(in);
    case 5:
      return new ROStatusChange(in);
    case 6:
      return new MoveChange(in);
    case 7:
      return new DeleteChange(in);
    case 8:
      return new PutLabelChange(in);
    case 9:
      return new PutSystemLabelChange(in);
  }
  throw new IOException("unexpected change type: " + type);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:StreamUtil.java

示例5: deserialize

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的package包/类
@NotNull
private Stub deserialize(@NotNull StubInputStream stream, @Nullable Stub parentStub) throws IOException, SerializerNotFoundException {
  final int id = DataInputOutputUtil.readINT(stream);
  final ObjectStubSerializer serializer = getClassById(id);
  if (serializer == null) {
    String externalId = null;
    try {
      externalId = myNameStorage.valueOf(id);
    } catch (Throwable ignore) {}
    throw new SerializerNotFoundException("No serializer registered for stub: ID=" + id + ", externalId:" + externalId + "; parent stub class=" + (parentStub != null? parentStub.getClass().getName() : "null"));
  }

  Stub stub = serializer.deserialize(stream, parentStub);
  int childCount = DataInputOutputUtil.readINT(stream);
  for (int i = 0; i < childCount; i++) {
    deserialize(stream, stub);
  }
  return stub;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:StubSerializationHelper.java

示例6: persistAttribute

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的package包/类
@Override
public void persistAttribute(@NotNull VirtualFile fileOrDir, @NotNull LanguageLevel level) throws IOException {
  final DataInputStream iStream = PERSISTENCE.readAttribute(fileOrDir);
  if (iStream != null) {
    try {
      final int oldLevelOrdinal = DataInputOutputUtil.readINT(iStream);
      if (oldLevelOrdinal == level.ordinal()) return;
    }
    finally {
      iStream.close();
    }
  }

  final DataOutputStream oStream = PERSISTENCE.writeAttribute(fileOrDir);
  DataInputOutputUtil.writeINT(oStream, level.ordinal());
  oStream.close();

  for (VirtualFile child : fileOrDir.getChildren()) {
    if (!child.isDirectory() && StdFileTypes.JAVA.equals(child.getFileType())) {
      FileBasedIndex.getInstance().requestReindex(child);
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:JavaLanguageLevelPusher.java

示例7: readAttribute

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的package包/类
@Nullable
public DataInputStream readAttribute(VirtualFile file) {
  DataInputStream stream = ManagingFS.getInstance().readAttribute(file, this);
  if (stream != null) {
    try {
      int actualVersion = DataInputOutputUtil.readINT(stream);
      if (actualVersion != myVersion) {
        stream.close();
        return null;
      }
    }
    catch (IOException e) {
      return null;
    }
  }
  return stream;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:FileAttribute.java

示例8: deserialize

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的package包/类
@NotNull
public Stub deserialize(@NotNull InputStream stream) throws IOException, SerializerNotFoundException {
  FileLocalStringEnumerator storage = new FileLocalStringEnumerator();
  StubInputStream inputStream = new StubInputStream(stream, storage);
  final int size = DataInputOutputUtil.readINT(inputStream);
  byte[] buffer = IOUtil.allocReadWriteUTFBuffer();

  int i = 1;
  while(i <= size) {
    String s = myStringInterner.get(IOUtil.readUTFFast(buffer, inputStream));
    storage.myStrings.add(s);
    storage.myEnumerates.put(s, i);
    ++i;
  }
  return deserialize(inputStream, null);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:StubSerializationHelper.java

示例9: read

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的package包/类
@NotNull
@Override
public StubIdList read(final DataInput in) throws IOException {
  int size = DataInputOutputUtil.readINT(in);
  if (size == Integer.MAX_VALUE) {
    return new StubIdList();
  }
  else if (size >= 0) {
    return new StubIdList(size);
  }
  else {
    size = -size;
    int[] result = new int[size];
    for(int i = 0; i < size; ++i) {
      result[i] = DataInputOutputUtil.readINT(in);
    }
    return new StubIdList(result, size);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:StubIndexImpl.java

示例10: readCompressedWithoutOriginalBufferLength

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的package包/类
@Nonnull
public static byte[] readCompressedWithoutOriginalBufferLength(@Nonnull DataInput in) throws IOException {
  int size = DataInputOutputUtil.readINT(in);

  byte[] bytes = spareBufferLocal.getBuffer(size);
  in.readFully(bytes, 0, size);

  int decompressedRequests = myDecompressionRequests.incrementAndGet();
  long started = System.nanoTime();

  byte[] decompressedResult = Snappy.uncompress(bytes, 0, size);

  long doneTime = System.nanoTime() - started;
  long decompressedSize = myDecompressedSize.addAndGet(size);
  long decompressedTime = myDecompressionTime.addAndGet(doneTime);
  if (DUMP_COMPRESSION_STATS && decompressedRequests % 1000 == 0) {
    System.out.println("Decompressed " + decompressedRequests + " times, size: " + decompressedSize  + " for " + (decompressedTime / 1000000) + "ms");
  }

  return decompressedResult;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:CompressionUtil.java

示例11: read

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的package包/类
@Nonnull
@Override
public StubIdList read(@Nonnull final DataInput in) throws IOException {
  int size = DataInputOutputUtil.readINT(in);
  if (size == Integer.MAX_VALUE) {
    return new StubIdList();
  }
  else if (size >= 0) {
    return new StubIdList(size);
  }
  else {
    size = -size;
    int[] result = new int[size];
    for(int i = 0; i < size; ++i) {
      result[i] = DataInputOutputUtil.readINT(in);
    }
    return new StubIdList(result, size);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:StubIndexImpl.java

示例12: versionDiffers

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的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

示例13: getFileData

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的package包/类
@Override
public Data getFileData(@Nonnull Project project, @Nonnull VirtualFile file) {
  ApplicationManager.getApplication().assertReadAccessAllowed();
  ProgressManager.checkCanceled();

  if (!(file instanceof VirtualFileWithId)) return myCalculator.calcData(project, file);

  int stamp = PersistentFS.getInstance().getModificationCount(file) + ((GistManagerImpl)GistManager.getInstance()).getReindexCount();

  try (DataInputStream stream = getFileAttribute(project).readAttribute(file)) {
    if (stream != null && DataInputOutputUtil.readINT(stream) == stamp) {
      return stream.readBoolean() ? myExternalizer.read(stream) : null;
    }
  }
  catch (IOException e) {
    LOG.error(e);
  }

  Data result = myCalculator.calcData(project, file);
  cacheResult(stamp, result, project, file);
  return result;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:VirtualFileGistImpl.java

示例14: read

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的package包/类
public static TIntHashSet read(final TIntHashSet acc, final DataInput in) {
  try {
    final int size = DataInputOutputUtil.readINT(in);

    for (int i = 0; i<size; i++) {
      acc.add(DataInputOutputUtil.readINT(in));
    }

    return acc;
  }
  catch (IOException x) {
    throw new BuildDataCorruptedException(x);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:RW.java

示例15: Proto

import com.intellij.util.io.DataInputOutputUtil; //导入方法依赖的package包/类
protected Proto(final DataInput in) {
  try {
    access = DataInputOutputUtil.readINT(in);
    signature = DataInputOutputUtil.readINT(in);
    name = DataInputOutputUtil.readINT(in);
  }
  catch (IOException e) {
    throw new BuildDataCorruptedException(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:Proto.java


注:本文中的com.intellij.util.io.DataInputOutputUtil.readINT方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。