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