CodedInputStream

true to leave input open when the returned is disposed; false to dispose of the given stream when the returned object is disposed.

Dispose

void Dispose()

Disposes of this instance, potentially closing any underlying stream.

As there is no flushing to perform here, disposing of a CodedInputStream which was constructed with the leaveOpen option parameter set to true (or one which was constructed to read from a byte array) has no effect.

MaybeConsumeTag

bool MaybeConsumeTag(
uint tag
)

Peeks at the next tag in the stream.

If it matches tag , the tag is consumed and the method returns true; otherwise, the stream is left in the original position and the method returns false.

PeekTag

uint PeekTag()

Peeks at the next field tag.

This is like calling ReadTag, but the tag is not consumed. (So a subsequent call to ReadTag will return the same value.)

ReadString

ReadTag

If this method returns 0, it doesn't necessarily mean the end of all the data in this CodedInputStream; it may be the end of the logical stream for an embedded message, for example.

Details

Returns

The next field tag, or 0 for end of stream. (0 is never a valid tag.)

ReadUInt32

uint ReadUInt32()

Reads a uint32 field value from the stream.

ReadUInt64

ulong ReadUInt64()

Reads a uint64 field from the stream.

SkipLastField

void SkipLastField()

Skips the data for the field with the tag we've just read.

This should be called directly after ReadTag, when the caller wishes to skip an unknown field.

This method throws InvalidProtocolBufferException if the last-read tag was an end-group tag. If a caller wishes to skip a group, they should skip the whole group, by calling this method after reading the start-group tag. This behavior allows callers to call this method on any field they don't understand, correctly resulting in an error if an end-group tag has not been paired with an earlier start-group tag.

Details

Exceptions

InvalidProtocolBufferException

The last tag was an end-group tag

InvalidOperationException

The last read operation read to the end of the logical stream

Public static functions

CreateWithLimits

Creates a CodedInputStream with the specified size and recursion limits, reading from an input stream.

This method exists separately from the constructor to reduce the number of constructor overloads. It is likely to be used considerably less frequently than the constructors, as the default limits are suitable for most use cases.

Details

Parameters

input

The input stream to read from

sizeLimit

The total limit of data to read from the stream.

recursionLimit

The maximum recursion depth to allow while reading.

Returns

A CodedInputStream reading from input with the specified size and recursion limits.