Here you can find the source of writeVarLong(ByteBuffer buff, long x)
Parameter | Description |
---|---|
buff | the target buffer |
x | the value |
public static void writeVarLong(ByteBuffer buff, long x)
//package com.java2s; /*//from w w w .j av a 2s.com * Copyright 2004-2011 H2 Group. Multiple-Licensed under the H2 License, * Version 1.0, and under the Eclipse Public License, Version 1.0 * (http://h2database.com/html/license.html). * Initial Developer: H2 Group */ import java.nio.ByteBuffer; public class Main { /** * Write a variable size int. * * @param buff the target buffer * @param x the value */ public static void writeVarLong(ByteBuffer buff, long x) { while ((x & ~0x7f) != 0) { buff.put((byte) (0x80 | (x & 0x7f))); x >>>= 7; } buff.put((byte) x); } }