public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { bool isset_type = false; bool isset_uncompressed_page_size = false; bool isset_compressed_page_size = 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) { Type = (PageType)iprot.ReadI32(); isset_type = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.I32) { Uncompressed_page_size = iprot.ReadI32(); isset_uncompressed_page_size = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.I32) { Compressed_page_size = iprot.ReadI32(); isset_compressed_page_size = true; } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.I32) { Crc = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 5: if (field.Type == TType.Struct) { Data_page_header = new DataPageHeader(); Data_page_header.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 6: if (field.Type == TType.Struct) { Index_page_header = new IndexPageHeader(); Index_page_header.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 7: if (field.Type == TType.Struct) { Dictionary_page_header = new DictionaryPageHeader(); Dictionary_page_header.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 8: if (field.Type == TType.Struct) { Data_page_header_v2 = new DataPageHeaderV2(); Data_page_header_v2.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); if (!isset_type) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_uncompressed_page_size) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_compressed_page_size) { throw new TProtocolException(TProtocolException.INVALID_DATA); } } finally { iprot.DecrementRecursionDepth(); } }
public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) { iprot.IncrementRecursionDepth(); try { bool isset_type = false; bool isset_uncompressed_page_size = false; bool isset_compressed_page_size = false; TField field; await iprot.ReadStructBeginAsync(cancellationToken); while (true) { field = await iprot.ReadFieldBeginAsync(cancellationToken); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.I32) { Type = (PageType)await iprot.ReadI32Async(cancellationToken); isset_type = true; } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 2: if (field.Type == TType.I32) { Uncompressed_page_size = await iprot.ReadI32Async(cancellationToken); isset_uncompressed_page_size = true; } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 3: if (field.Type == TType.I32) { Compressed_page_size = await iprot.ReadI32Async(cancellationToken); isset_compressed_page_size = true; } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 4: if (field.Type == TType.I32) { Crc = await iprot.ReadI32Async(cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 5: if (field.Type == TType.Struct) { Data_page_header = new DataPageHeader(); await Data_page_header.ReadAsync(iprot, cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 6: if (field.Type == TType.Struct) { Index_page_header = new IndexPageHeader(); await Index_page_header.ReadAsync(iprot, cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 7: if (field.Type == TType.Struct) { Dictionary_page_header = new DictionaryPageHeader(); await Dictionary_page_header.ReadAsync(iprot, cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 8: if (field.Type == TType.Struct) { Data_page_header_v2 = new DataPageHeaderV2(); await Data_page_header_v2.ReadAsync(iprot, cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; default: await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); break; } await iprot.ReadFieldEndAsync(cancellationToken); } await iprot.ReadStructEndAsync(cancellationToken); if (!isset_type) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_uncompressed_page_size) { throw new TProtocolException(TProtocolException.INVALID_DATA); } if (!isset_compressed_page_size) { throw new TProtocolException(TProtocolException.INVALID_DATA); } } finally { iprot.DecrementRecursionDepth(); } }