Java ByteBuffer Write writeUnsignedInt(final ByteBuffer buffer, final long value)

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

Description

Write the given long value as a 4 byte unsigned integer.

License

Apache License

Parameter

Parameter Description
buffer The buffer to write to
value The value to write

Declaration

public static void writeUnsignedInt(final ByteBuffer buffer, final long value) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.nio.ByteBuffer;

public class Main {
    /**/*from  w w  w . ja va  2s. c  om*/
     * Write the given long value as a 4 byte unsigned integer. Overflow is ignored.
     *
     * @param buffer The buffer to write to
     * @param value  The value to write
     */
    public static void writeUnsignedInt(final ByteBuffer buffer, final long value) {
        buffer.putInt((int) (value & 0xffffffffL));
    }

    /**
     * Write the given long value as a 4 byte unsigned integer. Overflow is ignored.
     *
     * @param buffer The buffer to write to
     * @param index  The position in the buffer at which to begin writing
     * @param value  The value to write
     */
    public static void writeUnsignedInt(final ByteBuffer buffer, final int index, final long value) {
        buffer.putInt(index, (int) (value & 0xffffffffL));
    }
}

Related

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