本文整理了Java中com.esotericsoftware.kryo.Kryo.writeObjectOrNull()
方法的一些代码示例,展示了Kryo.writeObjectOrNull()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Kryo.writeObjectOrNull()
方法的具体详情如下:
包路径:com.esotericsoftware.kryo.Kryo
类名称:Kryo
方法名:writeObjectOrNull
[英]Writes an object or null using the specified serializer. The registered serializer is ignored.
[中]使用指定的序列化程序写入对象或null。已注册的序列化程序将被忽略。
代码示例来源:origin: apache/hive
@Override
public void write(Kryo kryo, Output output, Map map) {
super.write(kryo, output, map);
CopyOnFirstWriteProperties p = (CopyOnFirstWriteProperties) map;
Properties ip = p.getInterned();
kryo.writeObjectOrNull(output, ip, Properties.class);
}
代码示例来源:origin: EsotericSoftware/kryonet
public void write (Kryo kryo, Output output) {
output.writeInt(objectID, true);
output.writeInt(cachedMethod.methodClassID, true);
output.writeByte(cachedMethod.methodIndex);
Serializer[] serializers = cachedMethod.serializers;
Object[] args = this.args;
for (int i = 0, n = serializers.length; i < n; i++) {
Serializer serializer = serializers[i];
if (serializer != null)
kryo.writeObjectOrNull(output, args[i], serializer);
else
kryo.writeClassAndObject(output, args[i]);
}
output.writeByte(responseData);
}
代码示例来源:origin: apache/tinkerpop
@Override
public void writeObjectOrNull(final UnshadedOutputAdapter output, final Object object, final Class type) {
unshadedKryo.writeObjectOrNull(output.getUnshadedOutput(), object, type);
}
}
代码示例来源:origin: apache/servicecomb-pack
@Override
public byte[] serialize(Object[] objects) {
Output output = new Output(DEFAULT_BUFFER_SIZE, -1);
Kryo kryo = pool.borrow();
kryo.writeObjectOrNull(output, objects, Object[].class);
pool.release(kryo);
return output.toBytes();
}
代码示例来源:origin: ome/formats-gpl
@Override
public void write(Kryo kryo, Output out) {
kryo.writeObjectOrNull(out, currentFile, String.class);
kryo.writeObjectOrNull(out, attributeList, Vector.class);
kryo.writeObjectOrNull(out, variableList, Vector.class);
}
代码示例来源:origin: openmicroscopy/bioformats
@Override
public void write(Kryo kryo, Output out) {
kryo.writeObjectOrNull(out, currentFile, String.class);
kryo.writeObjectOrNull(out, attributeList, Vector.class);
kryo.writeObjectOrNull(out, variableList, Vector.class);
}
代码示例来源:origin: srikalyc/Sql4D
@Override
public void write(Kryo kryo, Output output, T t) {
Map<String, Object> map = toMap();
for (String key:map.keySet()) {
Object value = map.get(key);
kryo.writeClass(output, value.getClass());
kryo.writeObjectOrNull(output, key, String.class);
kryo.writeObjectOrNull(output, value, value.getClass());
}
}
代码示例来源:origin: org.apache.samoa/samoa-api
@Override
public void write(Kryo kryo, Output output, TargetMean t) {
kryo.writeObjectOrNull(output, new TargetMeanData(t), TargetMeanData.class);
}
代码示例来源:origin: YahooArchive/samoa
@Override
public void write(Kryo kryo, Output output, Perceptron p) {
kryo.writeObjectOrNull(output, new PerceptronData(p), PerceptronData.class);
}
代码示例来源:origin: YahooArchive/samoa
@Override
public void write(Kryo kryo, Output output, TargetMean t) {
kryo.writeObjectOrNull(output, new TargetMeanData(t), TargetMeanData.class);
}
代码示例来源:origin: org.apache.tinkerpop/spark-gremlin
@Override
public void writeObjectOrNull(final UnshadedOutputAdapter output, final Object object, final Class type) {
unshadedKryo.writeObjectOrNull(output.getUnshadedOutput(), object, type);
}
}
代码示例来源:origin: com.yahoo.sql4d/Sql4Ddriver
@Override
public void write(Kryo kryo, Output output, T t) {
Map<String, Object> map = toMap();
for (String key:map.keySet()) {
Object value = map.get(key);
kryo.writeClass(output, value.getClass());
kryo.writeObjectOrNull(output, key, String.class);
kryo.writeObjectOrNull(output, value, value.getClass());
}
}
代码示例来源:origin: org.apache.samoa/samoa-api
@Override
public void write(Kryo kryo, Output output, Perceptron p) {
kryo.writeObjectOrNull(output, new PerceptronData(p), PerceptronData.class);
}
代码示例来源:origin: org.apache.servicecomb.saga/omega-format
@Override
public byte[] serialize(Object[] objects) {
Output output = new Output(DEFAULT_BUFFER_SIZE, -1);
Kryo kryo = pool.borrow();
kryo.writeObjectOrNull(output, objects, Object[].class);
pool.release(kryo);
return output.toBytes();
}
代码示例来源:origin: org.onosproject/onos-core-serializers
@Override
public void write(Kryo kryo, Output output, MastershipTerm object) {
kryo.writeObjectOrNull(output, object.master(), nodeIdSerializer());
output.writeLong(object.termNumber());
}
}
代码示例来源:origin: ome/formats-common
@Override
public void write(Kryo kryo, Output out) {
kryo.writeClassAndObject(out, raf);
kryo.writeObjectOrNull(out, file, String.class);
kryo.writeObject(out, length);
kryo.writeObject(out, markedPos);
kryo.writeObject(out, encoding);
}
代码示例来源:origin: org.openmicroscopy/ome-common
@Override
public void write(Kryo kryo, Output out) {
kryo.writeClassAndObject(out, raf);
kryo.writeObjectOrNull(out, file, String.class);
kryo.writeObject(out, length);
kryo.writeObject(out, markedPos);
kryo.writeObject(out, encoding);
}
代码示例来源:origin: uk.gov.gchq.gaffer/spark-library
@Override
public void write(final Kryo kryo, final Output output, final Entity entity) {
output.writeString(entity.getGroup());
kryo.writeClass(output, entity.getVertex().getClass());
kryo.writeObject(output, entity.getVertex());
kryo.writeObjectOrNull(output, entity.getProperties(), Properties.class);
}
代码示例来源:origin: uk.gov.gchq.gaffer/spark-library
@Override
public void write(final Kryo kryo, final Output output, final Edge edge) {
output.writeString(edge.getGroup());
kryo.writeClass(output, edge.getSource().getClass());
kryo.writeObject(output, edge.getSource());
kryo.writeClass(output, edge.getDestination().getClass());
kryo.writeObject(output, edge.getDestination());
output.writeBoolean(edge.isDirected());
kryo.writeObjectOrNull(output, edge.getProperties(), Properties.class);
}
代码示例来源:origin: com.esotericsoftware.kryo/kryo
public void write (Kryo kryo, Output output, String[] object) {
if (object == null) {
output.writeVarInt(NULL, true);
return;
}
output.writeVarInt(object.length + 1, true);
if (kryo.getReferences() && kryo.getReferenceResolver().useReferences(String.class)) {
Serializer serializer = kryo.getSerializer(String.class);
for (int i = 0, n = object.length; i < n; i++)
kryo.writeObjectOrNull(output, object[i], serializer);
} else {
for (int i = 0, n = object.length; i < n; i++)
output.writeString(object[i]);
}
}
内容来源于网络,如有侵权,请联系作者删除!