Apache.NMS.ActiveMQ.OpenWire.OpenWireFormat.Unmarshal C# (CSharp) Method

Unmarshal() public method

public Unmarshal ( BinaryReader dis ) : Object
dis System.IO.BinaryReader
return Object
        public Object Unmarshal(BinaryReader dis)
        {
            // lets ignore the size of the packet
            if(!sizePrefixDisabled)
            {
                dis.ReadInt32();
            }

            // first byte is the type of the packet
            byte dataType = dis.ReadByte();

            if(dataType != NULL_TYPE)
            {
                BaseDataStreamMarshaller dsm = GetDataStreamMarshallerForType(dataType);

                Object data = dsm.CreateObject();

                if(tightEncodingEnabled)
                {
                    BooleanStream bs = new BooleanStream();
                    bs.Unmarshal(dis);
                    dsm.TightUnmarshal(this, data, dis, bs);
                    return data;
                }
                else
                {
                    dsm.LooseUnmarshal(this, data, dis);
                    return data;
                }
            }

            return null;
        }