use of org.apache.ignite.internal.binary.BinaryRawWriterEx in project ignite by apache.
the class PlatformFutureUtils method writeToWriter.
/**
* Write result to a custom writer
*
* @param obj Object to write.
* @param err Error to write.
* @param ctx Context.
* @param writer Writer.
* @param futPtr Future pointer.
* @return Value indicating whether custom write was performed. When false, default write will be used.
*/
private static boolean writeToWriter(Object obj, Throwable err, PlatformContext ctx, Writer writer, long futPtr) {
boolean canWrite = writer.canWrite(obj, err);
if (!canWrite)
return false;
try (PlatformMemory mem = ctx.memory().allocate()) {
PlatformOutputStream out = mem.output();
BinaryRawWriterEx outWriter = ctx.writer(out);
writer.write(outWriter, obj, err);
out.synchronize();
ctx.gateway().futureObjectResult(futPtr, mem.pointer());
}
return true;
}
Aggregations