/**
* Reads a value that was encoded via {@link #writeVarLongUnsigned(long, 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 long readVarLongUnsigned(DataInput in) throws IOException {
long value = 0L;
int i = 0;
long b;
while (((b = in.readByte()) & 0x80L) != 0) {
value |= (b & 0x7F) << i;
i += 7;
if (i > 63) {
throw new StreamCorruptedException("Variable length size is too long");
}
}
return value | b << i;
}
CodecUtils.java 文件源码
java
阅读 23
收藏 0
点赞 0
评论 0
项目:hekate
作者:
评论列表
文章目录