示例#1
0
文件: Msg.cs 项目: bojanskr/nats.net
        internal Msg(MsgArg arg, Subscription s, byte[] payload, long totalLen)
        {
            subject = arg.subject;
            sid     = arg.sid;
            _reply  = arg.reply;
            sub     = s;

            if (arg.hdr > 0)
            {
                HeaderStatusReader hsr = new HeaderStatusReader(payload, arg.hdr);
                header = hsr.Header;
                status = hsr.Status;
            }

            // make a deep copy of the bytes for this message.
            long payloadLen = totalLen - arg.hdr;

            if (payloadLen > 0)
            {
                data = new byte[payloadLen];
                Array.Copy(payload, arg.hdr, data, 0, (int)(totalLen - arg.hdr));
            }
            else
            {
                data = Empty;
            }
        }
示例#2
0
        internal Msg(MsgArg arg, Subscription s, byte[] payload, long length)
        {
            this.subject = arg.subject;
            this.reply   = arg.reply;
            this.sub     = s;

            // make a deep copy of the bytes for this message.
            this.data = new byte[length];
            Array.Copy(payload, this.data, length);
        }
示例#3
0
        internal Msg(MsgArg arg, Subscription s, byte[] payload, long length)
        {
            this.subject = arg.subject;
            this.reply   = arg.reply;
            this.sub     = s;

            // make a deep copy of the bytes for this message.
            this.data = new byte[length];
            Array.Copy(payload, this.data, length);
        }
示例#4
0
        internal Msg(MsgArg arg, Subscription s, byte[] payload, long length)
        {
            subject = arg.subject;
            reply   = arg.reply;
            sub     = s;

            // make a deep copy of the bytes for this message.
            if (length > 0)
            {
                data = new byte[length];
                Array.Copy(payload, 0, data, 0, (int)length);
            }
            else
            {
                data = Empty;
            }
        }
示例#5
0
        internal Msg(MsgArg arg, Subscription s, byte[] payload, long totalLen)
        {
            subject = arg.subject;
            reply   = arg.reply;
            sub     = s;

            if (arg.hdr > 0)
            {
                header = new MsgHeader(payload, arg.hdr);
            }

            // make a deep copy of the bytes for this message.
            if (totalLen > 0)
            {
                data = new byte[totalLen];
                Array.Copy(payload, (int)arg.hdr, data, 0, (int)(totalLen - arg.hdr));
            }
            else
            {
                data = Empty;
            }
        }