Java ByteBuffer Write writeUnsignedInt(ByteBuffer buf, long value)

Here you can find the source of writeUnsignedInt(ByteBuffer buf, long value)

Description

Marshall a long into the next 4 bytes in this buffer.

License

Open Source License

Declaration

public static void writeUnsignedInt(ByteBuffer buf, long value) 

Method Source Code


//package com.java2s;
/*-/*  www .  ja  v a 2s  .co m*/
 * See the file LICENSE for redistribution information.
 *
 * Copyright (c) 2002-2010 Oracle.  All rights reserved.
 *
 */

import java.nio.ByteBuffer;

public class Main {
    /**
     * Marshall a long into the next 4 bytes in this buffer. Necessary when the
     * long is used to hold an unsigned int.
     */
    public static void writeUnsignedInt(ByteBuffer buf, long value) {
        buf.put((byte) (value >>> 0));
        buf.put((byte) (value >>> 8));
        buf.put((byte) (value >>> 16));
        buf.put((byte) (value >>> 24));
    }
}

Related

  1. writeToFile(String name, ByteBuffer bb)
  2. writeTs(ByteBuffer is, long ts)
  3. writetUnsignedInt(ByteBuffer buffer, long value)
  4. writeUB2(ByteBuffer buffer, int i)
  5. writeUnsigned(int num, int size, ByteBuffer out)
  6. writeUnsignedInt(final ByteBuffer buffer, final long value)
  7. writeUnsignedVarInt(int value, ByteBuffer dest)
  8. writeUTF8StringToByteBuffer(String str, ByteBuffer bb)
  9. writeUUID(ByteBuffer buffer, UUID uuid)