Lines Matching +full:buffer +full:- +full:from
2 // Protocol Buffers - Google's data interchange format
4 // https://developers.google.com/protocol-buffers/
17 // contributors may be used to endorse or promote products derived from
49 /// primitives from the stream. It effectively encapsulates the lowest
50 /// levels of protocol buffer format.
67 /// Buffer of data read from the stream or provided at construction time.
69 private readonly byte[] buffer; field in Google.Protobuf.CodedInputStream
72 /// The stream to read further input from, or null if the byte array buffer was provided
88 … // Note that the checks are performed such that we don't end up checking obviously-valid things
89 // like non-null references for arrays we've just created.
92 /// Creates a new CodedInputStream reading data from the given byte array.
94 …public CodedInputStream(byte[] buffer) : this(null, ProtoPreconditions.CheckNotNull(buffer, "buffe… in CodedInputStream() argument
99 /// Creates a new <see cref="CodedInputStream"/> that reads from the given byte array slice.
101 public CodedInputStream(byte[] buffer, int offset, int length) in CodedInputStream() argument
102 … : this(null, ProtoPreconditions.CheckNotNull(buffer, "buffer"), offset, offset + length, true) in CodedInputStream()
104 if (offset < 0 || offset > buffer.Length) in CodedInputStream()
106 throw new ArgumentOutOfRangeException("offset", "Offset must be within the buffer"); in CodedInputStream()
108 if (length < 0 || offset + length > buffer.Length) in CodedInputStream()
110 …row new ArgumentOutOfRangeException("length", "Length must be non-negative and within the buffer"); in CodedInputStream()
115 …/// Creates a new <see cref="CodedInputStream"/> reading data from the given stream, which will be…
118 /// <param name="input">The stream to read from.</param>
124 /// Creates a new <see cref="CodedInputStream"/> reading data from the given stream.
126 /// <param name="input">The stream to read from.</param>
136 /// Creates a new CodedInputStream reading data from the given
137 /// stream and buffer, using the default limits.
139 …internal CodedInputStream(Stream input, byte[] buffer, int bufferPos, int bufferSize, bool leaveOp… in CodedInputStream() argument
142 this.buffer = buffer; in CodedInputStream()
154 /// Creates a new CodedInputStream reading data from the given
155 /// stream and buffer, using the specified limits.
161 …internal CodedInputStream(Stream input, byte[] buffer, int bufferPos, int bufferSize, int sizeLimi… in CodedInputStream() argument
162 : this(input, buffer, bufferPos, bufferSize, leaveOpen) in CodedInputStream()
179 /// from an input stream.
182 …/// This method exists separately from the constructor to reduce the number of constructor overloa…
186 /// <param name="input">The input stream to read from</param>
187 /// <param name="sizeLimit">The total limit of data to read from the stream.</param>
189 …/// <returns>A <c>CodedInputStream</c> reading from <paramref name="input"/> with the specified si…
198 /// Returns the current position in the input stream, or the position in the input buffer
206 … return input.Position - ((state.bufferSize + state.bufferSizeAfterLimit) - state.bufferPos);
222 /// This limit is applied when reading from the underlying stream, as a sanity check. It is
223 /// not applied when reading from a byte array data source without an underlying stream.
233 /// to avoid maliciously-recursive data.
244 … /// Internal-only property; when set to true, unknown fields will be discarded while parsing.
253 … /// Internal-only property; provides extension identifiers to compatible messages while parsing.
261 internal byte[] InternalBuffer => buffer;
273 /// was constructed to read from a byte array) has no effect.
285 /// Verifies that the last call to ReadTag() returned tag 0 - in other words,
305 var span = new ReadOnlySpan<byte>(buffer); in PeekTag()
320 var span = new ReadOnlySpan<byte>(buffer); in ReadTag()
330 …thod throws <see cref="InvalidProtocolBufferException"/> if the last-read tag was an end-group tag.
332 …/// start-group tag. This behavior allows callers to call this method on any field they don't unde…
333 … /// resulting in an error if an end-group tag has not been paired with an earlier start-group tag.
335 … /// <exception cref="InvalidProtocolBufferException">The last tag was an end-group tag</exception>
339 var span = new ReadOnlySpan<byte>(buffer); in SkipLastField()
348 var span = new ReadOnlySpan<byte>(buffer); in SkipGroup()
353 /// Reads a double field from the stream.
357 var span = new ReadOnlySpan<byte>(buffer); in ReadDouble()
362 /// Reads a float field from the stream.
366 var span = new ReadOnlySpan<byte>(buffer); in ReadFloat()
371 /// Reads a uint64 field from the stream.
379 /// Reads an int64 field from the stream.
387 /// Reads an int32 field from the stream.
395 /// Reads a fixed64 field from the stream.
403 /// Reads a fixed32 field from the stream.
411 /// Reads a bool field from the stream.
419 /// Reads a string field from the stream.
423 var span = new ReadOnlySpan<byte>(buffer); in ReadString()
428 /// Reads an embedded message field value from the stream.
434 …// What happens is that we first initialize a ParseContext from the current coded input stream onl… in ReadMessage()
435 …// we will need to switch back again to CodedInputStream-based parsing (which involves copying and… in ReadMessage()
437 …// For now, this inefficiency is fine, considering this is only a backward-compatibility scenario … in ReadMessage()
438 ParseContext.Initialize(buffer.AsSpan(), ref state, out ParseContext ctx); in ReadMessage()
450 /// Reads an embedded group field from the stream.
466 /// Reads a bytes field value from the stream.
470 var span = new ReadOnlySpan<byte>(buffer); in ReadBytes()
475 /// Reads a uint32 field value from the stream.
483 /// Reads an enum field value from the stream.
487 … // Currently just a pass-through, but it's nice to separate it logically from WriteInt32. in ReadEnum()
492 /// Reads an sfixed32 field value from the stream.
500 /// Reads an sfixed64 field value from the stream.
508 /// Reads an sint32 field value from the stream.
516 /// Reads an sint64 field value from the stream.
524 /// Reads a length for length-delimited data.
532 var span = new ReadOnlySpan<byte>(buffer); in ReadLength()
543 var span = new ReadOnlySpan<byte>(buffer); in MaybeConsumeTag()
552 /// Reads a raw Varint from the stream. If larger than 32 bits, discard the upper bits.
553 /// This method is optimised for the case where we've got lots of data in the buffer.
554 /// That means we can check the size just once, then just read directly from the buffer
555 /// without constant rechecking of the buffer length.
559 var span = new ReadOnlySpan<byte>(buffer); in ReadRawVarint32()
564 /// Reads a varint from the input one byte at a time, so that it does not
578 /// Reads a raw varint from the stream.
582 var span = new ReadOnlySpan<byte>(buffer); in ReadRawVarint64()
587 /// Reads a 32-bit little-endian integer from the stream.
591 var span = new ReadOnlySpan<byte>(buffer); in ReadRawLittleEndian32()
596 /// Reads a 64-bit little-endian integer from the stream.
600 var span = new ReadOnlySpan<byte>(buffer); in ReadRawLittleEndian64()
605 #region Internal reading and buffer management
609 /// when descending into a length-delimited embedded message. The previous
647 var span = new ReadOnlySpan<byte>(buffer);
653 /// Called when buffer is empty to read more bytes from the
655 /// either there will be at least one byte in the buffer when it returns
663 var span = new ReadOnlySpan<byte>(buffer); in RefillBuffer()
668 /// Reads a fixed size of bytes from the input.
675 var span = new ReadOnlySpan<byte>(buffer); in ReadRawBytes()
680 …/// Reads a top-level message or a nested message after the limits for this message have been push…
682 …/// NOTE: this method needs to be public because it's invoked by the generated code - e.g. msg.Mer…