Java ByteBuffer Put putUnsignedInt(ByteBuffer buffer, long value)

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

Description

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

License

Open Source License

Parameter

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

Declaration

public static void putUnsignedInt(ByteBuffer buffer, long value) 

Method Source Code

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

import java.nio.ByteBuffer;

public class Main {
    /**/*from w  w  w  .java  2  s  .c  o m*/
     * 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 putUnsignedInt(ByteBuffer buffer, 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 putUnsignedInt(ByteBuffer buffer, int index, long value) {
        buffer.putInt(index, (int) (value & 0xffffffffL));
    }
}

Related

  1. putTriByte(ByteBuffer buf, int value)
  2. putTruncatedInt(ByteBuffer bytes, int value, int numBytes)
  3. putUInt16(ByteBuffer buffer, long value)
  4. putUInt32(ByteBuffer buffer, long value)
  5. putUnsignedByte(ByteBuffer bb, int value)
  6. putUnsignedInt(final ByteBuffer dst, final long value)
  7. putUnsignedShort(ByteBuffer bytes, int value)
  8. putUUID(ByteBuffer bytes, UUID uuid)
  9. putVarint(ByteBuffer buffer, long number, int byteSize)