Google.Protobuf.CodedInputStream.PopLimit C# (CSharp) Method

PopLimit() private method

Discards the current limit, returning the previous limit.
private PopLimit ( int oldLimit ) : void
oldLimit int
return void
        internal void PopLimit(int oldLimit)
        {
            currentLimit = oldLimit;
            RecomputeBufferSizeAfterLimit();
        }

Usage Example

Example #1
0
            internal static T Read <T>(CodedInputStream input, FieldCodec <T> codec)
            {
                int length   = input.ReadLength();
                int oldLimit = input.PushLimit(length);

                uint tag;
                T    value = codec.DefaultValue;

                while (input.ReadTag(out tag))
                {
                    if (tag == 0)
                    {
                        throw InvalidProtocolBufferException.InvalidTag();
                    }
                    if (tag == codec.Tag)
                    {
                        value = codec.Read(input);
                    }
                    if (WireFormat.IsEndGroupTag(tag))
                    {
                        break;
                    }
                }
                input.CheckLastTagWas(0);
                input.PopLimit(oldLimit);

                return(value);
            }
All Usage Examples Of Google.Protobuf.CodedInputStream::PopLimit