コード例 #1
0
 public BloomFilterHeader(int numBytes, BloomFilterAlgorithm algorithm, BloomFilterHash hash, BloomFilterCompression compression) : this()
 {
     this.NumBytes    = numBytes;
     this.Algorithm   = algorithm;
     this.Hash        = hash;
     this.Compression = compression;
 }
コード例 #2
0
        public void Read(TProtocol iprot)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                bool   isset_numBytes    = false;
                bool   isset_algorithm   = false;
                bool   isset_hash        = false;
                bool   isset_compression = 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)
                        {
                            NumBytes       = iprot.ReadI32();
                            isset_numBytes = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.Struct)
                        {
                            Algorithm = new BloomFilterAlgorithm();
                            Algorithm.Read(iprot);
                            isset_algorithm = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.Struct)
                        {
                            Hash = new BloomFilterHash();
                            Hash.Read(iprot);
                            isset_hash = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 4:
                        if (field.Type == TType.Struct)
                        {
                            Compression = new BloomFilterCompression();
                            Compression.Read(iprot);
                            isset_compression = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
                if (!isset_numBytes)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
                if (!isset_algorithm)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
                if (!isset_hash)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
                if (!isset_compression)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA);
                }
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }