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


Java DataExternalizer.read方法代码示例

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


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

示例1: ClassType

import com.intellij.util.io.DataExternalizer; //导入方法依赖的package包/类
ClassType(final DependencyContext context, final DataInput in) {
  try {
    className = in.readInt();
    final int size = in.readInt();
    if (size == 0) {
      typeArgs = EMPTY_TYPE_ARRAY;
    }
    else {
      typeArgs = new AbstractType[size];
      final DataExternalizer<AbstractType> externalizer = externalizer(context);
      for (int i = 0; i < size; i++) {
        typeArgs[i] = externalizer.read(in);
      }
    }
  }
  catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:TypeRepr.java

示例2: read

import com.intellij.util.io.DataExternalizer; //导入方法依赖的package包/类
public static <X> X[] read(final DataExternalizer<X> e, final DataInput in, final X[] result) {
  try {
    for (int i = 0; i < result.length; i++) {
      result[i] = e.read(in);
    }

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

示例3: MethodUsage

import com.intellij.util.io.DataExternalizer; //导入方法依赖的package包/类
private MethodUsage(final DependencyContext context, final DataInput in) {
  super(in);
  try {
    final DataExternalizer<TypeRepr.AbstractType> externalizer = TypeRepr.externalizer(context);
    int argumentTypes = DataInputOutputUtil.readINT(in);
    myArgumentTypes = RW.read(externalizer, in, argumentTypes != 0 ? new TypeRepr.AbstractType[argumentTypes]: TypeRepr.AbstractType.EMPTY_TYPE_ARRAY);
    myReturnType = externalizer.read(in);
  }
  catch (IOException e) {
    throw new BuildDataCorruptedException(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:UsageRepr.java

示例4: AnnotationUsage

import com.intellij.util.io.DataExternalizer; //导入方法依赖的package包/类
private AnnotationUsage(final DependencyContext context, final DataInput in) {
  final DataExternalizer<TypeRepr.AbstractType> externalizer = TypeRepr.externalizer(context);

  try {
    myType = (TypeRepr.ClassType)externalizer.read(in);
    myUsedArguments = RW.read(new TIntHashSet(DEFAULT_SET_CAPACITY, DEFAULT_SET_LOAD_FACTOR), in);
    myUsedTargets = (EnumSet<ElemType>)RW.read(elementTypeExternalizer, EnumSet.noneOf(ElemType.class), in);
  }
  catch (IOException e) {
    throw new BuildDataCorruptedException(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:UsageRepr.java

示例5: read

import com.intellij.util.io.DataExternalizer; //导入方法依赖的package包/类
public static <X> X[] read(final DataExternalizer<X> e, final DataInput in, final X[] result) {
  try {
    for (int i = 0; i < result.length; i++) {
      result[i] = e.read(in);
    }

    return result;
  }
  catch (IOException x) {
    throw new RuntimeException(x);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:RW.java

示例6: MethodUsage

import com.intellij.util.io.DataExternalizer; //导入方法依赖的package包/类
private MethodUsage(final DependencyContext context, final DataInput in) {
  super(in);
  try {
    final DataExternalizer<TypeRepr.AbstractType> externalizer = TypeRepr.externalizer(context);
    myArgumentTypes = RW.read(externalizer, in, new TypeRepr.AbstractType[in.readInt()]);
    myReturnType = externalizer.read(in);
  }
  catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:12,代码来源:UsageRepr.java

示例7: AnnotationUsage

import com.intellij.util.io.DataExternalizer; //导入方法依赖的package包/类
private AnnotationUsage(final DependencyContext context, final DataInput in) {
  final DataExternalizer<TypeRepr.AbstractType> externalizer = TypeRepr.externalizer(context);

  try {
    myType = (TypeRepr.ClassType)externalizer.read(in);
    myUsedArguments = RW.read(new TIntHashSet(DEFAULT_SET_CAPACITY, DEFAULT_SET_LOAD_FACTOR), in);
    myUsedTargets = (EnumSet<ElemType>)RW.read(elementTypeExternalizer, EnumSet.noneOf(ElemType.class), in);
  }
  catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:UsageRepr.java

示例8: createDataExternalizer

import com.intellij.util.io.DataExternalizer; //导入方法依赖的package包/类
public static DataExternalizer<UsageIndexValue> createDataExternalizer() {
  final DataExternalizer<MethodIncompleteSignature> methodInvocationDataExternalizer = MethodIncompleteSignature.createKeyDescriptor();
  return new DataExternalizer<UsageIndexValue>() {
    @Override
    public void save(final DataOutput out, final UsageIndexValue value) throws IOException {
      methodInvocationDataExternalizer.save(out, value.myMethodIncompleteSignature);
      out.writeInt(value.myOccurrences);
    }

    @Override
    public UsageIndexValue read(final DataInput in) throws IOException {
      return new UsageIndexValue(methodInvocationDataExternalizer.read(in), in.readInt());
    }
  };
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:16,代码来源:UsageIndexValue.java

示例9: checkValuesHaveProperEqualsAndHashCode

import com.intellij.util.io.DataExternalizer; //导入方法依赖的package包/类
public static <Key, Value> void checkValuesHaveProperEqualsAndHashCode(@Nonnull Map<Key, Value> data,
                                                                       @Nonnull ID<Key, Value> indexId,
                                                                       @Nonnull DataExternalizer<Value> valueExternalizer) {
  if (DebugAssertions.DEBUG) {
    for (Map.Entry<Key, Value> e : data.entrySet()) {
      final Value value = e.getValue();
      if (!(Comparing.equal(value, value) && (value == null || value.hashCode() == value.hashCode()))) {
        LOG.error("Index " + indexId.toString() + " violates equals / hashCode contract for Value parameter");
      }

      try {
        final BufferExposingByteArrayOutputStream out = new BufferExposingByteArrayOutputStream();
        DataOutputStream outputStream = new DataOutputStream(out);
        valueExternalizer.save(outputStream, value);
        outputStream.close();
        final Value deserializedValue =
                valueExternalizer.read(new DataInputStream(new UnsyncByteArrayInputStream(out.getInternalBuffer(), 0, out.size())));

        if (!(Comparing.equal(value, deserializedValue) && (value == null || value.hashCode() == deserializedValue.hashCode()))) {
          LOG.error("Index " + indexId.toString() + " deserialization violates equals / hashCode contract for Value parameter");
        }
      }
      catch (IOException ex) {
        LOG.error(ex);
      }
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:29,代码来源:MapReduceIndex.java

示例10: readFrom

import com.intellij.util.io.DataExternalizer; //导入方法依赖的package包/类
public void readFrom(DataInputStream stream, DataExternalizer<Value> externalizer) throws IOException {
  FileId2ValueMapping<Value> mapping = null;

  while (stream.available() > 0) {
    final int valueCount = DataInputOutputUtil.readINT(stream);
    if (valueCount < 0) {
      // ChangeTrackingValueContainer marked inputId as invalidated, see ChangeTrackingValueContainer.saveTo
      final int inputId = -valueCount;

      if (mapping == null && size() > NUMBER_OF_VALUES_THRESHOLD) { // avoid O(NumberOfValues)
        mapping = new FileId2ValueMapping<Value>(this);
      }

      boolean doCompact;
      if(mapping != null) {
        doCompact = mapping.removeFileId(inputId);
      } else {
        removeAssociatedValue(inputId);
        doCompact = true;
      }

      if (doCompact) setNeedsCompacting(true);
    }
    else {
      for (int valueIdx = 0; valueIdx < valueCount; valueIdx++) {
        final Value value = externalizer.read(stream);
        int idCountOrSingleValue = DataInputOutputUtil.readINT(stream);

        if (idCountOrSingleValue > 0) {
          addValue(idCountOrSingleValue, value);
          if (mapping != null) mapping.associateFileIdToValue(idCountOrSingleValue, value);
        } else {
          idCountOrSingleValue = -idCountOrSingleValue;
          ChangeBufferingList changeBufferingList = ensureFileSetCapacityForValue(value, idCountOrSingleValue);
          int prev = 0;

          for (int i = 0; i < idCountOrSingleValue; i++) {
            final int id = DataInputOutputUtil.readINT(stream);
            if (changeBufferingList != null)  changeBufferingList.add(prev + id);
            else addValue(prev + id, value);
            if (mapping != null) mapping.associateFileIdToValue(prev + id, value);
            prev += id;
          }
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:49,代码来源:ValueContainerImpl.java


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