Java ByteBuffer to Int readUnsignedTriByte(ByteBuffer buffer)

Here you can find the source of readUnsignedTriByte(ByteBuffer buffer)

Description

Reads an unsigned tri byte from the specified buffer.

License

Open Source License

Parameter

Parameter Description
buffer The buffer.

Return

The tri byte.

Declaration

public static int readUnsignedTriByte(ByteBuffer buffer) 

Method Source Code


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

import java.nio.ByteBuffer;

public class Main {
    /**//from  www.  ja va2s .  c o m
     * Reads an unsigned tri byte from the specified buffer.
     * 
     * @param buffer The buffer.
     * @return The tri byte.
     */
    public static int readUnsignedTriByte(ByteBuffer buffer) {
        return (buffer.get() & 0xFF) << 16 | (buffer.get() & 0xFF) << 8 | buffer.get() & 0xFF;
    }
}

Related

  1. readUnsignedInt(ByteBuffer buffer, int index)
  2. readUnsignedInt(ByteBuffer byteBuf)
  3. readUnsignedMedium(ByteBuffer buf)
  4. readUnsignedShort(ByteBuffer bb)
  5. readUnsignedShort(ByteBuffer buffer)
  6. readUnsignedVarint(ByteBuffer buffer)
  7. readVarInt(ByteBuffer buff)
  8. readVarInt(ByteBuffer buff)
  9. readVarint(ByteBuffer buffer)