Java ByteBuffer Write writeV(ByteBuffer byteBuffer, List vint)

Here you can find the source of writeV(ByteBuffer byteBuffer, List vint)

Description

write V

License

Open Source License

Declaration

public static void writeV(ByteBuffer byteBuffer, List<Integer> vint) 

Method Source Code


//package com.java2s;
/*/*from   www  .  j  a v a  2s .c o  m*/
 * (C) 2007-2010 Alibaba Group Holding Limited.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 */

import java.nio.ByteBuffer;
import java.util.List;

public class Main {
    public static void writeV(ByteBuffer byteBuffer, List<Integer> vint) {
        if (vint == null)
            return;
        // write vector's length
        byteBuffer.putInt(vint.size());
        // write content
        for (int i = 0; i < vint.size(); ++i) {
            byteBuffer.putInt(vint.get(i));
        }
    }
}

Related

  1. writeUnsignedInt(ByteBuffer buf, long value)
  2. writeUnsignedInt(final ByteBuffer buffer, final long value)
  3. writeUnsignedVarInt(int value, ByteBuffer dest)
  4. writeUTF8StringToByteBuffer(String str, ByteBuffer bb)
  5. writeUUID(ByteBuffer buffer, UUID uuid)
  6. writeVarint(int value, ByteBuffer buffer)
  7. writeVarLong(ByteBuffer buff, long x)
  8. writeVarLong(ByteBuffer buff, long x)
  9. writeVarLong(long n, ByteBuffer buff)