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) {
           StartIndex = iprot.ReadI32();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.I32) {
           TotalNotes = iprot.ReadI32();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 3:
         if (field.Type == TType.List) {
           {
             Notes = new List<NoteMetadata>();
             TList _list64 = iprot.ReadListBegin();
             for( int _i65 = 0; _i65 < _list64.Count; ++_i65)
             {
               NoteMetadata _elem66 = new NoteMetadata();
               _elem66 = new NoteMetadata();
               _elem66.Read(iprot);
               Notes.Add(_elem66);
             }
             iprot.ReadListEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 4:
         if (field.Type == TType.List) {
           {
             StoppedWords = new List<string>();
             TList _list67 = iprot.ReadListBegin();
             for( int _i68 = 0; _i68 < _list67.Count; ++_i68)
             {
               string _elem69 = null;
               _elem69 = iprot.ReadString();
               StoppedWords.Add(_elem69);
             }
             iprot.ReadListEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 5:
         if (field.Type == TType.List) {
           {
             SearchedWords = new List<string>();
             TList _list70 = iprot.ReadListBegin();
             for( int _i71 = 0; _i71 < _list70.Count; ++_i71)
             {
               string _elem72 = null;
               _elem72 = iprot.ReadString();
               SearchedWords.Add(_elem72);
             }
             iprot.ReadListEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 6:
         if (field.Type == TType.I32) {
           UpdateCount = iprot.ReadI32();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }
        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)
                    {
                        StartIndex = iprot.ReadI32();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.I32)
                    {
                        TotalNotes = iprot.ReadI32();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 3:
                    if (field.Type == TType.List)
                    {
                        {
                            Notes = new List <NoteMetadata>();
                            TList _list64 = iprot.ReadListBegin();
                            for (int _i65 = 0; _i65 < _list64.Count; ++_i65)
                            {
                                NoteMetadata _elem66 = new NoteMetadata();
                                _elem66 = new NoteMetadata();
                                _elem66.Read(iprot);
                                Notes.Add(_elem66);
                            }
                            iprot.ReadListEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

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

                case 5:
                    if (field.Type == TType.List)
                    {
                        {
                            SearchedWords = new List <string>();
                            TList _list70 = iprot.ReadListBegin();
                            for (int _i71 = 0; _i71 < _list70.Count; ++_i71)
                            {
                                string _elem72 = null;
                                _elem72 = iprot.ReadString();
                                SearchedWords.Add(_elem72);
                            }
                            iprot.ReadListEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 6:
                    if (field.Type == TType.I32)
                    {
                        UpdateCount = iprot.ReadI32();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }
Example #3
0
        public void Read(TProtocol iprot)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                bool   isset_startIndex = false;
                bool   isset_totalNotes = false;
                bool   isset_notes      = 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.I32)
                        {
                            StartIndex       = iprot.ReadI32();
                            isset_startIndex = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.I32)
                        {
                            TotalNotes       = iprot.ReadI32();
                            isset_totalNotes = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.List)
                        {
                            {
                                Notes = new List <NoteMetadata>();
                                TList _list68 = iprot.ReadListBegin();
                                for (int _i69 = 0; _i69 < _list68.Count; ++_i69)
                                {
                                    NoteMetadata _elem70;
                                    _elem70 = new NoteMetadata();
                                    _elem70.Read(iprot);
                                    Notes.Add(_elem70);
                                }
                                iprot.ReadListEnd();
                            }
                            isset_notes = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

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

                    case 5:
                        if (field.Type == TType.List)
                        {
                            {
                                SearchedWords = new List <string>();
                                TList _list74 = iprot.ReadListBegin();
                                for (int _i75 = 0; _i75 < _list74.Count; ++_i75)
                                {
                                    string _elem76;
                                    _elem76 = iprot.ReadString();
                                    SearchedWords.Add(_elem76);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 6:
                        if (field.Type == TType.I32)
                        {
                            UpdateCount = iprot.ReadI32();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 7:
                        if (field.Type == TType.String)
                        {
                            SearchContextBytes = iprot.ReadBinary();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

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

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
                if (!isset_startIndex)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA, "required field StartIndex not set");
                }
                if (!isset_totalNotes)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA, "required field TotalNotes not set");
                }
                if (!isset_notes)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA, "required field Notes not set");
                }
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }