C# 클래스 Google.Protobuf.CodedInputStream

Readings and decodes protocol message fields.

This class is generally used by generated code to read appropriate primitives from the stream. It effectively encapsulates the lowest levels of protocol buffer format.

Repeated fields and map fields are not handled by this class; use RepeatedField{T} and MapField{TKey, TValue} to serialize such fields.

파일 보기 프로젝트 열기: Arctium-Emulation/Project-WoW 1 사용 예제들

Private Properties

프로퍼티 타입 설명
CheckReadEndOfStreamTag void
CodedInputStream Google.Protobuf.Collections
CodedInputStream Google.Protobuf.Collections
DecodeZigZag32 int
DecodeZigZag64 long
PopLimit void
PushLimit int
ReadRawByte byte
ReadRawBytes byte[]
ReadRawLittleEndian32 uint
ReadRawLittleEndian64 ulong
ReadRawVarint32 uint
ReadRawVarint32 uint
ReadRawVarint64 ulong
RecomputeBufferSizeAfterLimit void
RefillBuffer bool
SkipGroup void
SkipImpl void
SkipRawBytes void
SlowReadRawVarint32 uint

공개 메소드들

메소드 설명
CodedInputStream ( Stream input ) : Google.Protobuf.Collections

Creates a new CodedInputStream reading data from the given stream, which will be disposed when the returned object is disposed.

CodedInputStream ( Stream input, bool leaveOpen ) : Google.Protobuf.Collections

Creates a new CodedInputStream reading data from the given stream.

CodedInputStream ( byte buffer ) : Google.Protobuf.Collections

Creates a new CodedInputStream reading data from the given byte array.

CodedInputStream ( byte buffer, int offset, int length ) : Google.Protobuf.Collections

Creates a new CodedInputStream that reads from the given byte array slice.

CreateWithLimits ( Stream input, int sizeLimit, int recursionLimit ) : CodedInputStream

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.

Dispose ( ) : void

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 ( uint tag ) : bool

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

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.)

ReadBool ( ) : bool

Reads a bool field from the stream.

ReadBytes ( ) : ByteString

Reads a bytes field value from the stream.

ReadDouble ( ) : double

Reads a double field from the stream.

ReadEnum ( ) : int

Reads an enum field value from the stream.

ReadFixed32 ( ) : uint

Reads a fixed32 field from the stream.

ReadFixed64 ( ) : ulong

Reads a fixed64 field from the stream.

ReadFloat ( ) : float

Reads a float field from the stream.

ReadInt32 ( ) : int

Reads an int32 field from the stream.

ReadInt64 ( ) : long

Reads an int64 field from the stream.

ReadLength ( ) : int

Reads a length for length-delimited data.

This is internally just reading a varint, but this method exists to make the calling code clearer.

ReadMessage ( IMessage builder ) : void

Reads an embedded message field value from the stream.

ReadSFixed32 ( ) : int

Reads an sfixed32 field value from the stream.

ReadSFixed64 ( ) : long

Reads an sfixed64 field value from the stream.

ReadSInt32 ( ) : int

Reads an sint32 field value from the stream.

ReadSInt64 ( ) : long

Reads an sint64 field value from the stream.

ReadString ( ) : string

Reads a string field from the stream.

ReadTag ( ) : uint

Reads a field tag, returning the tag of 0 for "end of stream".

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.

ReadUInt32 ( ) : uint

Reads a uint32 field value from the stream.

ReadUInt64 ( ) : ulong

Reads a uint64 field from the stream.

SkipLastField ( ) : void

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.

비공개 메소드들

메소드 설명
CheckReadEndOfStreamTag ( ) : void

Verifies that the last call to ReadTag() returned tag 0 - in other words, we've reached the end of the stream when we expected to.

CodedInputStream ( Stream input, byte buffer, int bufferPos, int bufferSize ) : Google.Protobuf.Collections

Creates a new CodedInputStream reading data from the given stream and buffer, using the default limits.

CodedInputStream ( Stream input, byte buffer, int bufferPos, int bufferSize, int sizeLimit, int recursionLimit ) : Google.Protobuf.Collections

Creates a new CodedInputStream reading data from the given stream and buffer, using the specified limits.

This chains to the version with the default limits instead of vice versa to avoid having to check that the default values are valid every time.

DecodeZigZag32 ( uint n ) : int

Decode a 32-bit value with ZigZag encoding.

ZigZag encodes signed integers into values that can be efficiently encoded with varint. (Otherwise, negative values must be sign-extended to 64 bits to be varint encoded, thus always taking 10 bytes on the wire.)

DecodeZigZag64 ( ulong n ) : long

Decode a 32-bit value with ZigZag encoding.

ZigZag encodes signed integers into values that can be efficiently encoded with varint. (Otherwise, negative values must be sign-extended to 64 bits to be varint encoded, thus always taking 10 bytes on the wire.)

PopLimit ( int oldLimit ) : void

Discards the current limit, returning the previous limit.

PushLimit ( int byteLimit ) : int

Sets currentLimit to (current position) + byteLimit. This is called when descending into a length-delimited embedded message. The previous limit is returned.

ReadRawByte ( ) : byte

Read one byte from the input.

ReadRawBytes ( int size ) : byte[]

Reads a fixed size of bytes from the input.

ReadRawLittleEndian32 ( ) : uint

Reads a 32-bit little-endian integer from the stream.

ReadRawLittleEndian64 ( ) : ulong

Reads a 64-bit little-endian integer from the stream.

ReadRawVarint32 ( ) : uint

Reads a raw Varint from the stream. If larger than 32 bits, discard the upper bits. This method is optimised for the case where we've got lots of data in the buffer. That means we can check the size just once, then just read directly from the buffer without constant rechecking of the buffer length.

ReadRawVarint32 ( Stream input ) : uint

Reads a varint from the input one byte at a time, so that it does not read any bytes after the end of the varint. If you simply wrapped the stream in a CodedInputStream and used ReadRawVarint32(Stream) then you would probably end up reading past the end of the varint since CodedInputStream buffers its input.

ReadRawVarint64 ( ) : ulong

Reads a raw varint from the stream.

RecomputeBufferSizeAfterLimit ( ) : void
RefillBuffer ( bool mustSucceed ) : bool

Called when buffer is empty to read more bytes from the input. If mustSucceed is true, RefillBuffer() gurantees that either there will be at least one byte in the buffer when it returns or it will throw an exception. If mustSucceed is false, RefillBuffer() returns false if no more bytes were available.

SkipGroup ( uint startGroupTag ) : void
SkipImpl ( int amountToSkip ) : void

Abstraction of skipping to cope with streams which can't really skip.

SkipRawBytes ( int size ) : void

Reads and discards size bytes.

SlowReadRawVarint32 ( ) : uint

Same code as ReadRawVarint32, but read each byte individually, checking for buffer overflow.

메소드 상세

CodedInputStream() 공개 메소드

Creates a new CodedInputStream reading data from the given stream, which will be disposed when the returned object is disposed.
public CodedInputStream ( Stream input ) : Google.Protobuf.Collections
input Stream The stream to read from.
리턴 Google.Protobuf.Collections

CodedInputStream() 공개 메소드

Creates a new CodedInputStream reading data from the given stream.
public CodedInputStream ( Stream input, bool leaveOpen ) : Google.Protobuf.Collections
input Stream The stream to read from.
leaveOpen bool true to leave open when the returned /// is disposed; false to dispose of the given stream when the /// returned object is disposed.
리턴 Google.Protobuf.Collections

CodedInputStream() 공개 메소드

Creates a new CodedInputStream reading data from the given byte array.
public CodedInputStream ( byte buffer ) : Google.Protobuf.Collections
buffer byte
리턴 Google.Protobuf.Collections

CodedInputStream() 공개 메소드

Creates a new CodedInputStream that reads from the given byte array slice.
public CodedInputStream ( byte buffer, int offset, int length ) : Google.Protobuf.Collections
buffer byte
offset int
length int
리턴 Google.Protobuf.Collections

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.
public static CreateWithLimits ( Stream input, int sizeLimit, int recursionLimit ) : CodedInputStream
input Stream The input stream to read from
sizeLimit int The total limit of data to read from the stream.
recursionLimit int The maximum recursion depth to allow while reading.
리턴 CodedInputStream

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.
public Dispose ( ) : void
리턴 void

MaybeConsumeTag() 공개 메소드

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.
public MaybeConsumeTag ( uint tag ) : bool
tag uint
리턴 bool

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.)
public PeekTag ( ) : uint
리턴 uint

ReadBool() 공개 메소드

Reads a bool field from the stream.
public ReadBool ( ) : bool
리턴 bool

ReadBytes() 공개 메소드

Reads a bytes field value from the stream.
public ReadBytes ( ) : ByteString
리턴 ByteString

ReadDouble() 공개 메소드

Reads a double field from the stream.
public ReadDouble ( ) : double
리턴 double

ReadEnum() 공개 메소드

Reads an enum field value from the stream.
public ReadEnum ( ) : int
리턴 int

ReadFixed32() 공개 메소드

Reads a fixed32 field from the stream.
public ReadFixed32 ( ) : uint
리턴 uint

ReadFixed64() 공개 메소드

Reads a fixed64 field from the stream.
public ReadFixed64 ( ) : ulong
리턴 ulong

ReadFloat() 공개 메소드

Reads a float field from the stream.
public ReadFloat ( ) : float
리턴 float

ReadInt32() 공개 메소드

Reads an int32 field from the stream.
public ReadInt32 ( ) : int
리턴 int

ReadInt64() 공개 메소드

Reads an int64 field from the stream.
public ReadInt64 ( ) : long
리턴 long

ReadLength() 공개 메소드

Reads a length for length-delimited data.
This is internally just reading a varint, but this method exists to make the calling code clearer.
public ReadLength ( ) : int
리턴 int

ReadMessage() 공개 메소드

Reads an embedded message field value from the stream.
public ReadMessage ( IMessage builder ) : void
builder IMessage
리턴 void

ReadSFixed32() 공개 메소드

Reads an sfixed32 field value from the stream.
public ReadSFixed32 ( ) : int
리턴 int

ReadSFixed64() 공개 메소드

Reads an sfixed64 field value from the stream.
public ReadSFixed64 ( ) : long
리턴 long

ReadSInt32() 공개 메소드

Reads an sint32 field value from the stream.
public ReadSInt32 ( ) : int
리턴 int

ReadSInt64() 공개 메소드

Reads an sint64 field value from the stream.
public ReadSInt64 ( ) : long
리턴 long

ReadString() 공개 메소드

Reads a string field from the stream.
public ReadString ( ) : string
리턴 string

ReadTag() 공개 메소드

Reads a field tag, returning the tag of 0 for "end of stream".
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.
public ReadTag ( ) : uint
리턴 uint

ReadUInt32() 공개 메소드

Reads a uint32 field value from the stream.
public ReadUInt32 ( ) : uint
리턴 uint

ReadUInt64() 공개 메소드

Reads a uint64 field from the stream.
public ReadUInt64 ( ) : ulong
리턴 ulong

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.
The last tag was an end-group tag The last read operation read to the end of the logical stream
public SkipLastField ( ) : void
리턴 void