Read() public method

public Read ( TProtocol iprot ) : void
iprot Thrift.Protocol.TProtocol
return void
 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.String) {
       Start_token = iprot.ReadString();
     } else {
       TProtocolUtil.Skip(iprot, field.Type);
     }
     break;
       case 2:
     if (field.Type == TType.String) {
       End_token = iprot.ReadString();
     } else {
       TProtocolUtil.Skip(iprot, field.Type);
     }
     break;
       case 3:
     if (field.Type == TType.List) {
       {
         Endpoints = new List<string>();
         TList _list20 = iprot.ReadListBegin();
         for( int _i21 = 0; _i21 < _list20.Count; ++_i21)
         {
           string _elem22 = null;
           _elem22 = iprot.ReadString();
           Endpoints.Add(_elem22);
         }
         iprot.ReadListEnd();
       }
     } else {
       TProtocolUtil.Skip(iprot, field.Type);
     }
     break;
       case 4:
     if (field.Type == TType.List) {
       {
         Rpc_endpoints = new List<string>();
         TList _list23 = iprot.ReadListBegin();
         for( int _i24 = 0; _i24 < _list23.Count; ++_i24)
         {
           string _elem25 = null;
           _elem25 = iprot.ReadString();
           Rpc_endpoints.Add(_elem25);
         }
         iprot.ReadListEnd();
       }
     } else {
       TProtocolUtil.Skip(iprot, field.Type);
     }
     break;
       case 5:
     if (field.Type == TType.List) {
       {
         Endpoint_details = new List<EndpointDetails>();
         TList _list26 = iprot.ReadListBegin();
         for( int _i27 = 0; _i27 < _list26.Count; ++_i27)
         {
           EndpointDetails _elem28 = new EndpointDetails();
           _elem28 = new EndpointDetails();
           _elem28.Read(iprot);
           Endpoint_details.Add(_elem28);
         }
         iprot.ReadListEnd();
       }
     } else {
       TProtocolUtil.Skip(iprot, field.Type);
     }
     break;
       default:
     TProtocolUtil.Skip(iprot, field.Type);
     break;
     }
     iprot.ReadFieldEnd();
       }
       iprot.ReadStructEnd();
 }
示例#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.String)
                    {
                        Start_token = iprot.ReadString();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.String)
                    {
                        End_token = iprot.ReadString();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 3:
                    if (field.Type == TType.List)
                    {
                        {
                            Endpoints = new List <string>();
                            TList _list24 = iprot.ReadListBegin();
                            for (int _i25 = 0; _i25 < _list24.Count; ++_i25)
                            {
                                string _elem26 = null;
                                _elem26 = iprot.ReadString();
                                Endpoints.Add(_elem26);
                            }
                            iprot.ReadListEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 4:
                    if (field.Type == TType.List)
                    {
                        {
                            Rpc_endpoints = new List <string>();
                            TList _list27 = iprot.ReadListBegin();
                            for (int _i28 = 0; _i28 < _list27.Count; ++_i28)
                            {
                                string _elem29 = null;
                                _elem29 = iprot.ReadString();
                                Rpc_endpoints.Add(_elem29);
                            }
                            iprot.ReadListEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 5:
                    if (field.Type == TType.List)
                    {
                        {
                            Endpoint_details = new List <EndpointDetails>();
                            TList _list30 = iprot.ReadListBegin();
                            for (int _i31 = 0; _i31 < _list30.Count; ++_i31)
                            {
                                EndpointDetails _elem32 = new EndpointDetails();
                                _elem32 = new EndpointDetails();
                                _elem32.Read(iprot);
                                Endpoint_details.Add(_elem32);
                            }
                            iprot.ReadListEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }
示例#3
0
        public void Read(TProtocol iprot)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                bool   isset_start_token = false;
                bool   isset_end_token   = false;
                bool   isset_endpoints   = false;
                TField field;
                iprot.ReadStructBegin();
                while (true)
                {
                    field = iprot.ReadFieldBegin();
                    if (field.Type == TType.Stop)
                    {
                        break;
                    }
                    switch (field.ID)
                    {
                    case 1:
                        if (field.Type == TType.String)
                        {
                            Start_token       = iprot.ReadString();
                            isset_start_token = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.String)
                        {
                            End_token       = iprot.ReadString();
                            isset_end_token = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.List)
                        {
                            {
                                Endpoints = new List <string>();
                                TList _list28 = iprot.ReadListBegin();
                                for (int _i29 = 0; _i29 < _list28.Count; ++_i29)
                                {
                                    string _elem30;
                                    _elem30 = iprot.ReadString();
                                    Endpoints.Add(_elem30);
                                }
                                iprot.ReadListEnd();
                            }
                            isset_endpoints = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 4:
                        if (field.Type == TType.List)
                        {
                            {
                                Rpc_endpoints = new List <string>();
                                TList _list31 = iprot.ReadListBegin();
                                for (int _i32 = 0; _i32 < _list31.Count; ++_i32)
                                {
                                    string _elem33;
                                    _elem33 = iprot.ReadString();
                                    Rpc_endpoints.Add(_elem33);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 5:
                        if (field.Type == TType.List)
                        {
                            {
                                Endpoint_details = new List <EndpointDetails>();
                                TList _list34 = iprot.ReadListBegin();
                                for (int _i35 = 0; _i35 < _list34.Count; ++_i35)
                                {
                                    EndpointDetails _elem36;
                                    _elem36 = new EndpointDetails();
                                    _elem36.Read(iprot);
                                    Endpoint_details.Add(_elem36);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
                if (!isset_start_token)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA, "required field Start_token not set");
                }
                if (!isset_end_token)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA, "required field End_token not set");
                }
                if (!isset_endpoints)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA, "required field Endpoints not set");
                }
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }