Lines Matching defs:codec

94         /// Adds the entries from the given input stream, decoding them with the specified codec.

97 /// <param name="codec">The codec to use in order to read each entry.</param>
98 public void AddEntriesFrom(CodedInputStream input, FieldCodec<T> codec)
103 AddEntriesFrom(ref ctx, codec);
112 /// Adds the entries from the given parse context, decoding them with the specified codec.
115 /// <param name="codec">The codec to use in order to read each entry.</param>
117 public void AddEntriesFrom(ref ParseContext ctx, FieldCodec<T> codec)
122 var reader = codec.ValueReader;
136 if (codec.FixedSize > 0 && length % codec.FixedSize == 0 && ParsingPrimitives.IsDataAvailable(ref ctx.state, length))
138 EnsureSize(count + (length / codec.FixedSize));
171 /// Calculates the size of this collection based on the given codec.
173 /// <param name="codec">The codec to use when encoding each field.</param>
175 /// using the same codec.</returns>
176 public int CalculateSize(FieldCodec<T> codec)
182 uint tag = codec.Tag;
183 if (codec.PackedRepeatedField)
185 int dataSize = CalculatePackedDataSize(codec);
192 var sizeCalculator = codec.ValueSizeCalculator;
194 if (codec.EndTag != 0)
196 size += count * CodedOutputStream.ComputeRawVarint32Size(codec.EndTag);
206 private int CalculatePackedDataSize(FieldCodec<T> codec)
208 int fixedSize = codec.FixedSize;
211 var calculator = codec.ValueSizeCalculator;
227 /// encoding each value using the specified codec.
230 /// <param name="codec">The codec to use when encoding each value.</param>
231 public void WriteTo(CodedOutputStream output, FieldCodec<T> codec)
236 WriteTo(ref ctx, codec);
246 /// encoding each value using the specified codec.
249 /// <param name="codec">The codec to use when encoding each value.</param>
251 public void WriteTo(ref WriteContext ctx, FieldCodec<T> codec)
257 var writer = codec.ValueWriter;
258 var tag = codec.Tag;
259 if (codec.PackedRepeatedField)
262 int size = CalculatePackedDataSize(codec);
273 // Can't use codec.WriteTagAndValue, as that omits default values.
278 if (codec.EndTag != 0)
280 ctx.WriteTag(codec.EndTag);