/**
* Reads a value that was encoded via {@link #writeVarIntUnsigned(int, DataOutput)}.
*
* @param in Data input.
*
* @return Value.
*
* @throws IOException if failed to read value.
*/
// Code borrowed from 'stream-lib' (Apache 2.0 license) - see https://github.com/addthis/stream-lib
public static int readVarIntUnsigned(DataInput in) throws IOException {
int value = 0;
int i = 0;
int b;
while (((b = in.readByte()) & 0x80) != 0) {
value |= (b & 0x7F) << i;
i += 7;
if (i > 35) {
throw new StreamCorruptedException("Variable length size is too long");
}
}
return value | b << i;
}
CodecUtils.java 文件源码
java
阅读 25
收藏 0
点赞 0
评论 0
项目:hekate
作者:
评论列表
文章目录