Search in sources :

Example 1 with Output

use of com.google.protobuf.ByteString.Output in project drools by kiegroup.

the class PersisterHelper method writeStrategiesIndex.

private static void writeStrategiesIndex(MarshallerWriteContext context, ProtobufMessages.Header.Builder _header) throws IOException {
    for (Entry<ObjectMarshallingStrategy, Integer> entry : context.usedStrategies.entrySet()) {
        Builder _strat = ProtobufMessages.Header.StrategyIndex.newBuilder().setId(entry.getValue().intValue()).setName(entry.getKey().getName());
        Context ctx = context.strategyContext.get(entry.getKey());
        if (ctx != null) {
            Output os = ByteString.newOutput();
            ctx.write(new DroolsObjectOutputStream(os));
            _strat.setData(os.toByteString());
            os.close();
        }
        _header.addStrategy(_strat.build());
    }
}
Also used : Context(org.kie.api.marshalling.ObjectMarshallingStrategy.Context) ObjectMarshallingStrategy(org.kie.api.marshalling.ObjectMarshallingStrategy) Builder(org.drools.core.marshalling.impl.ProtobufMessages.Header.StrategyIndex.Builder) Output(com.google.protobuf.ByteString.Output) DroolsObjectOutputStream(org.drools.core.common.DroolsObjectOutputStream)

Aggregations

Output (com.google.protobuf.ByteString.Output)1 DroolsObjectOutputStream (org.drools.core.common.DroolsObjectOutputStream)1 Builder (org.drools.core.marshalling.impl.ProtobufMessages.Header.StrategyIndex.Builder)1 ObjectMarshallingStrategy (org.kie.api.marshalling.ObjectMarshallingStrategy)1 Context (org.kie.api.marshalling.ObjectMarshallingStrategy.Context)1