Here you can find the source of readVarLong(ByteBuffer buff)
Parameter | Description |
---|---|
buff | the source buffer |
public static long readVarLong(ByteBuffer buff)
//package com.java2s; /*//from w w w . j a va 2s.c om * Copyright 2004-2014 H2 Group. Multiple-Licensed under the MPL 2.0, * and the EPL 1.0 (http://h2database.com/html/license.html). * Initial Developer: H2 Group */ import java.nio.ByteBuffer; public class Main { /** * Read a variable size long. * * @param buff the source buffer * @return the value */ public static long readVarLong(ByteBuffer buff) { long x = buff.get(); if (x >= 0) { return x; } x &= 0x7f; for (int s = 7; s < 64; s += 7) { long b = buff.get(); x |= (b & 0x7f) << s; if (b >= 0) { break; } } return x; } }