Read() public method

public Read ( TProtocol iprot ) : void
iprot Thrift.Protocol.TProtocol
return void
Example #1
0
 public void Read(TProtocol iprot)
 {
     TField field;
     iprot.ReadStructBegin();
     while (true)
     {
         field = iprot.ReadFieldBegin();
         if (field.Type == TType.Stop)
         {
             break;
         }
         switch (field.ID)
         {
             case 1:
                 if (field.Type == TType.I32)
                 {
                     NodeType = (NodeType)iprot.ReadI32();
                 }
                 else
                 {
                     TProtocolUtil.Skip(iprot, field.Type);
                 }
                 break;
             case 2:
                 if (field.Type == TType.List)
                 {
                     {
                         Roots = new List<string>();
                         TList _list4 = iprot.ReadListBegin();
                         for (int _i5 = 0; _i5 < _list4.Count; ++_i5)
                         {
                             string _elem6 = null;
                             _elem6 = iprot.ReadString();
                             Roots.Add(_elem6);
                         }
                         iprot.ReadListEnd();
                     }
                 }
                 else
                 {
                     TProtocolUtil.Skip(iprot, field.Type);
                 }
                 break;
             case 3:
                 if (field.Type == TType.List)
                 {
                     {
                         AdjacencyList = new List<Adjacency>();
                         TList _list7 = iprot.ReadListBegin();
                         for (int _i8 = 0; _i8 < _list7.Count; ++_i8)
                         {
                             Adjacency _elem9 = new Adjacency();
                             _elem9 = new Adjacency();
                             _elem9.Read(iprot);
                             AdjacencyList.Add(_elem9);
                         }
                         iprot.ReadListEnd();
                     }
                 }
                 else
                 {
                     TProtocolUtil.Skip(iprot, field.Type);
                 }
                 break;
             default:
                 TProtocolUtil.Skip(iprot, field.Type);
                 break;
         }
         iprot.ReadFieldEnd();
     }
     iprot.ReadStructEnd();
 }
Example #2
0
        public void Read(TProtocol iprot)
        {
            TField field;

            iprot.ReadStructBegin();
            while (true)
            {
                field = iprot.ReadFieldBegin();
                if (field.Type == TType.Stop)
                {
                    break;
                }
                switch (field.ID)
                {
                case 1:
                    if (field.Type == TType.I32)
                    {
                        NodeType = (NodeType)iprot.ReadI32();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.List)
                    {
                        {
                            Roots = new List <string>();
                            TList _list4 = iprot.ReadListBegin();
                            for (int _i5 = 0; _i5 < _list4.Count; ++_i5)
                            {
                                string _elem6 = null;
                                _elem6 = iprot.ReadString();
                                Roots.Add(_elem6);
                            }
                            iprot.ReadListEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 3:
                    if (field.Type == TType.List)
                    {
                        {
                            AdjacencyList = new List <Adjacency>();
                            TList _list7 = iprot.ReadListBegin();
                            for (int _i8 = 0; _i8 < _list7.Count; ++_i8)
                            {
                                Adjacency _elem9 = new Adjacency();
                                _elem9 = new Adjacency();
                                _elem9.Read(iprot);
                                AdjacencyList.Add(_elem9);
                            }
                            iprot.ReadListEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }