Protobuf: added missing NoTag-versions of some serialization functions in runtime

This commit is contained in:
dsavvinov
2016-08-10 20:42:28 +03:00
parent d32ef8ee75
commit 0f86f30623
2 changed files with 12 additions and 1 deletions
@@ -86,9 +86,12 @@ class CodedInputStream(val buffer: ByteArray) {
fun readSInt64(expectedFieldNumber: Int): Long {
val tag = readTag(expectedFieldNumber, WireType.VARINT)
return readZigZag64NoTag()
return readSInt64NoTag()
}
fun readSInt64NoTag(): Long {
return readZigZag64NoTag()
}
fun readBytes(expectedFieldNumber: Int): ByteArray {
val tag = readTag(expectedFieldNumber, WireType.LENGTH_DELIMITED)
return readBytesNoTag()
@@ -26,6 +26,10 @@ class CodedOutputStream(val buffer: ByteArray) {
writeInt32(fieldNumber, value)
}
fun writeUInt32NoTag(value: Int) {
writeInt32NoTag(value)
}
fun writeInt64(fieldNumber: Int, value: Long) {
writeTag(fieldNumber, WireType.VARINT)
writeInt64NoTag(value)
@@ -36,6 +40,10 @@ class CodedOutputStream(val buffer: ByteArray) {
writeInt64(fieldNumber, value)
}
fun writeUInt64NoTag(value: Long) {
writeInt64NoTag(value)
}
fun writeBool(fieldNumber: Int, value: Boolean) {
writeTag(fieldNumber, WireType.VARINT)
writeBoolNoTag(value)