Java ByteBuffer Put writeVarInt(ByteBuffer buffer, int input)

Here you can find the source of writeVarInt(ByteBuffer buffer, int input)

Description

write Var Int

License

Open Source License

Declaration

public static void writeVarInt(ByteBuffer buffer, int input) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.nio.ByteBuffer;

public class Main {
    public static void writeVarInt(ByteBuffer buffer, int input) {
        while ((input & -128) != 0) {
            buffer.put((byte) (input & 127 | 128));
            input >>>= 7;//w  w  w.j av a  2  s  . c  o  m
        }

        buffer.put((byte) input);
    }
}

Related

  1. writeOutputStream(OutputStream output, ByteBuffer data)
  2. writeOutputStreamWriter(String str, int offset, int count, OutputStream out, ByteBuffer bytes, CharsetEncoder encoder, Object lock)
  3. writePackedLong(ByteBuffer output, long value)
  4. writeShortByteArray(ByteBuffer name, DataOutput out)
  5. writeTo(ByteBuffer buffer, OutputStream out)