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


Java DataExternalizer.save方法代码示例

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


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

示例1: save

import com.intellij.util.io.DataExternalizer; //导入方法依赖的package包/类
public static <X> void save(final Collection<X> x, final DataExternalizer<X> e, final DataOutput out) {
  try {
    DataInputOutputUtil.writeINT(out, x.size());

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

示例2: save

import com.intellij.util.io.DataExternalizer; //导入方法依赖的package包/类
public static <X> void save(final Collection<X> x, final DataExternalizer<X> e, final DataOutput out) {
  try {
    out.writeInt(x.size());

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

示例3: 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

示例4: 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


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