Exemplo n.º 1
0
        /// <summary>
        /// This method retrieves the Tlv from a byte stream object.
        /// </summary>
        /// <param name="stm">Byte stream</param>
        public virtual void GetFromStream(SmppReader stm)
        {
            tag_ = stm.ReadShort();
            int length = stm.ReadShort();

            data_ = new SmppByteStream(stm.ReadBytes(length));
        }
Exemplo n.º 2
0
        /// <summary>
        /// This method copies the SMPP byte stream to a new buffer
        /// </summary>
        /// <param name="rhs">Existing byte buffer</param>
        /// <returns>New stream copy</returns>
        static public SmppByteStream Copy(SmppByteStream rhs)
        {
            if (rhs != null && rhs.Length > 0)
            {
                byte[] buffer = new byte[rhs.Length];
                System.Array.Copy(rhs.GetBuffer(), 0, buffer, 0, rhs.Length);
                return(new SmppByteStream(buffer));
            }

            return(new SmppByteStream());
        }