use of org.objenesis.strategy.StdInstantiatorStrategy in project sling by apache.
the class KryoContentSerializer method exportToStream.
@Override
public void exportToStream(ResourceResolver resourceResolver, DistributionExportOptions options, OutputStream outputStream) throws DistributionException {
DistributionExportFilter filter = options.getFilter();
Kryo kryo = new Kryo();
kryo.setInstantiatorStrategy(new Kryo.DefaultInstantiatorStrategy(new StdInstantiatorStrategy()));
kryo.addDefaultSerializer(Resource.class, new ResourceSerializer(filter.getPropertyFilter()));
kryo.addDefaultSerializer(InputStream.class, new InputStreamSerializer());
Output output = new Output(outputStream);
LinkedList<Resource> resources = new LinkedList<Resource>();
for (DistributionExportFilter.TreeFilter nodeFilter : filter.getNodeFilters()) {
Resource resource = resourceResolver.getResource(nodeFilter.getPath());
if (resource != null) {
addResource(nodeFilter, resources, resource);
}
}
kryo.writeObject(output, resources);
output.flush();
}
use of org.objenesis.strategy.StdInstantiatorStrategy in project storm by apache.
the class KinesisConnectionInfo method getKryoSerializedBytes.
private byte[] getKryoSerializedBytes(final Object obj) {
final Kryo kryo = new Kryo();
final ByteArrayOutputStream os = new ByteArrayOutputStream();
final Output output = new Output(os);
kryo.setInstantiatorStrategy(new StdInstantiatorStrategy());
kryo.writeClassAndObject(output, obj);
output.flush();
return os.toByteArray();
}
use of org.objenesis.strategy.StdInstantiatorStrategy in project flink by apache.
the class WritableComparator method checkKryoInitialized.
// --------------------------------------------------------------------------------------------
private void checkKryoInitialized() {
if (this.kryo == null) {
this.kryo = new Kryo();
Kryo.DefaultInstantiatorStrategy instantiatorStrategy = new Kryo.DefaultInstantiatorStrategy();
instantiatorStrategy.setFallbackInstantiatorStrategy(new StdInstantiatorStrategy());
kryo.setInstantiatorStrategy(instantiatorStrategy);
this.kryo.setAsmEnabled(true);
this.kryo.register(type);
}
}
use of org.objenesis.strategy.StdInstantiatorStrategy in project flink by apache.
the class WritableSerializer method checkKryoInitialized.
private void checkKryoInitialized() {
if (this.kryo == null) {
this.kryo = new Kryo();
Kryo.DefaultInstantiatorStrategy instantiatorStrategy = new Kryo.DefaultInstantiatorStrategy();
instantiatorStrategy.setFallbackInstantiatorStrategy(new StdInstantiatorStrategy());
kryo.setInstantiatorStrategy(instantiatorStrategy);
this.kryo.setAsmEnabled(true);
this.kryo.register(typeClass);
}
}
use of org.objenesis.strategy.StdInstantiatorStrategy in project flink by apache.
the class AvroSerializer method checkKryoInitialized.
private void checkKryoInitialized() {
if (this.kryo == null) {
this.kryo = new Kryo();
Kryo.DefaultInstantiatorStrategy instantiatorStrategy = new Kryo.DefaultInstantiatorStrategy();
instantiatorStrategy.setFallbackInstantiatorStrategy(new StdInstantiatorStrategy());
kryo.setInstantiatorStrategy(instantiatorStrategy);
// register Avro types.
this.kryo.register(GenericData.Array.class, new Serializers.SpecificInstanceCollectionSerializerForArrayList());
this.kryo.register(Utf8.class);
this.kryo.register(GenericData.EnumSymbol.class);
this.kryo.register(GenericData.Fixed.class);
this.kryo.register(GenericData.StringType.class);
this.kryo.setAsmEnabled(true);
this.kryo.register(type);
}
}
Aggregations