コード例 #1
0
func decodeRemlenFromNetwork(src *bufio.ReadWriter) ([]byte, uint32) {
	var bytes []byte
	var rLength uint32
	var count int
	var multiplier uint32 = 1
	var digit byte
	count = 1
	for {
		digit, _ = src.ReadByte()
		bytes = append(bytes, digit)
		rLength += uint32(digit&127) * multiplier
		if (digit & 128) == 0 {
			break
		}
		multiplier *= 128
		count++
	}
	return bytes, rLength
}