class ProtoReader
Reads and decodes protocol message fields.
ProtoReader(source: BufferedSource) |
fun beginMessage(): Long
Begin a nested message. A call to this method will restrict the reader so that |
|
fun endMessage(token: Long): Unit
End a length-delimited nested message. Calls to this method must be symmetric with calls to |
|
fun forEachTag(tagHandler: TagHandler): ByteString
Reads each tag, handles it, and returns a byte string with the unknown fields. |
|
fun nextTag(): Int
Reads and returns the next tag of the message, or -1 if there are no further tags. Use |
|
fun peekFieldEncoding(): FieldEncoding
Returns the encoding of the next field value. |
|
fun readBytes(): ByteString
Reads a |
|
fun readFixed32(): Int
Reads a 32-bit little-endian integer from the stream. |
|
fun readFixed64(): Long
Reads a 64-bit little-endian integer from the stream. |
|
fun readString(): String
Reads a |
|
fun readVarint32(): Int
Reads a raw varint from the stream. If larger than 32 bits, discard the upper bits. |
|
fun readVarint64(): Long
Reads a raw varint up to 64 bits in length from the stream. |
|
fun skip(): Unit
Skips the current field's value. This is only safe to call immediately following a call to |