TightUnmarshal() public method

public TightUnmarshal ( OpenWireFormat wireFormat, Object o, BinaryReader dataIn, BooleanStream bs ) : void
wireFormat OpenWireFormat
o Object
dataIn System.IO.BinaryReader
bs BooleanStream
return void
Beispiel #1
0
        public DataStructure TightUnmarshalNestedObject(BinaryReader dis, BooleanStream bs)
        {
            if (bs.ReadBoolean())
            {
                byte dataType = dis.ReadByte();

                BaseDataStreamMarshaller dsm  = GetDataStreamMarshallerForType(dataType);
                DataStructure            data = dsm.CreateObject();

                if (data.IsMarshallAware() && bs.ReadBoolean())
                {
                    dis.ReadInt32();
                    dis.ReadByte();

                    BooleanStream bs2 = new BooleanStream();
                    bs2.Unmarshal(dis);
                    dsm.TightUnmarshal(this, data, dis, bs2);
                }
                else
                {
                    dsm.TightUnmarshal(this, data, dis, bs);
                }

                return(data);
            }

            return(null);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        public DataStructure TightUnmarshalNestedObject(BinaryReader dis, BooleanStream bs)
        {
            if (bs.ReadBoolean())
            {
                byte dataType = dis.ReadByte();
                BaseDataStreamMarshaller dsm = (BaseDataStreamMarshaller)dataMarshallers[dataType & 0xFF];
                if (dsm == null)
                {
                    throw new IOException("Unknown data type: " + dataType);
                }
                DataStructure data = dsm.CreateObject();

                if (data.IsMarshallAware() && bs.ReadBoolean())
                {
                    dis.ReadInt32();
                    dis.ReadByte();

                    BooleanStream bs2 = new BooleanStream();
                    bs2.Unmarshal(dis);
                    dsm.TightUnmarshal(this, data, dis, bs2);

                    // TODO: extract the sequence from the dis and associate it.
                    //                MarshallAware ma = (MarshallAware)data
                    //                ma.setCachedMarshalledForm(this, sequence);
                }
                else
                {
                    dsm.TightUnmarshal(this, data, dis, bs);
                }

                return(data);
            }
            else
            {
                return(null);
            }
        }
Beispiel #4
0
        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 = dataMarshallers[dataType & 0xFF];
                if (dsm == null)
                {
                    throw new IOException("Unknown data type: " + dataType);
                }
                Tracer.Debug("Parsing type: " + dataType + " with: " + dsm);
                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);
                }
            }
            else
            {
                return(null);
            }
        }