コード例 #1
0
        public static ByteString ReadBytes(ref ReadOnlySpan <byte> buffer, ref ParserInternalState state)
        {
            int length = ParsingPrimitives.ParseLength(ref buffer, ref state);

            return(ByteString.AttachBytes(ParsingPrimitives.ReadRawBytes(ref buffer, ref state, length)));
        }
コード例 #2
0
        /// <summary>
        /// Reads a fixed size of bytes from the input.
        /// </summary>
        /// <exception cref="InvalidProtocolBufferException">
        /// the end of the stream or the current limit was reached
        /// </exception>
        internal byte[] ReadRawBytes(int size)
        {
            var span = new ReadOnlySpan <byte>(buffer);

            return(ParsingPrimitives.ReadRawBytes(ref span, ref state, size));
        }