public T InStreamOutStream <T>(int type, Action <IBinaryRawWriter> writeAction, Func <IBinaryRawReader, T> readAction) { try { using (var outStream = IgniteManager.Memory.Allocate().GetStream()) using (var inStream = IgniteManager.Memory.Allocate().GetStream()) { var writer = _marsh.StartMarshal(outStream); writeAction(writer); FinishMarshal(writer); UU.TargetInStreamOutStream(_target, type, outStream.SynchronizeOutput(), inStream.MemoryPointer); inStream.SynchronizeInput(); return(readAction(_marsh.StartUnmarshal(inStream))); } } catch (JavaException jex) { throw ConvertException(jex); } }
/** <inheritdoc /> */ public TR InStreamOutStream <TR>(int type, Action <IBinaryStream> writeAction, Func <IBinaryStream, TR> readAction, Func <Exception, TR> errorAction = null) { try { using (var outStream = IgniteManager.Memory.Allocate().GetStream()) using (var inStream = IgniteManager.Memory.Allocate().GetStream()) { writeAction(outStream); UU.TargetInStreamOutStream(_target, type, outStream.SynchronizeOutput(), inStream.MemoryPointer); inStream.SynchronizeInput(); return(readAction(inStream)); } } catch (JavaException jex) { if (errorAction != null) { return(errorAction.Invoke(ConvertException(jex))); } throw ConvertException(jex); } }