/** <inheritdoc /> */
        public TR InStreamOutLong <TR>(int type, Action <IBinaryStream> outAction, Func <IBinaryStream, long, TR> inAction,
                                       Func <IBinaryStream, Exception> readErrorAction)
        {
            try
            {
                Debug.Assert(readErrorAction != null);

                using (var stream = IgniteManager.Memory.Allocate().GetStream())
                {
                    outAction(stream);

                    var res = UU.TargetInStreamOutLong(_target, type, stream.SynchronizeOutput());

                    if (res != PlatformTargetAdapter.Error && inAction == null)
                    {
                        return(default(TR));  // quick path for void operations
                    }
                    stream.SynchronizeInput();

                    stream.Seek(0, SeekOrigin.Begin);

                    if (res != PlatformTargetAdapter.Error)
                    {
                        return(inAction != null?inAction(stream, res) : default(TR));
                    }

                    throw readErrorAction(stream);
                }
            }
            catch (JavaException jex)
            {
                throw ConvertException(jex);
            }
        }
Exemplo n.º 2
0
        /** <inheritdoc /> */
        public long InStreamOutLong(int type, Action <IBinaryStream> writeAction)
        {
            try
            {
                using (var stream = IgniteManager.Memory.Allocate().GetStream())
                {
                    writeAction(stream);

                    return(UU.TargetInStreamOutLong(_target, type, stream.SynchronizeOutput()));
                }
            }
            catch (JavaException jex)
            {
                throw ConvertException(jex);
            }
        }
Exemplo n.º 3
0
        public long InStreamOutLong(int type, Action <IBinaryRawWriter> writeAction)
        {
            try
            {
                using (var stream = IgniteManager.Memory.Allocate().GetStream())
                {
                    var writer = _marsh.StartMarshal(stream);

                    writeAction(writer);

                    FinishMarshal(writer);

                    return(UU.TargetInStreamOutLong(_target, type, stream.SynchronizeOutput()));
                }
            }
            catch (JavaException jex)
            {
                throw ConvertException(jex);
            }
        }