Java ByteBuffer Get getUByte(ByteBuffer b)

Here you can find the source of getUByte(ByteBuffer b)

Description

get U Byte

License

Open Source License

Declaration

public static int getUByte(ByteBuffer b) 

Method Source Code

//package com.java2s;
/*/*  w ww . j  a  v  a  2s .  c o m*/
 * JaamSim Discrete Event Simulation
 * Copyright (C) 2012 Ausenco Engineering Canada Inc.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

import java.nio.ByteBuffer;

public class Main {
    public static int getUByte(ByteBuffer b) {
        return unsign(b.get());
    }

    public static int getUByte(ByteBuffer b, int ind) {
        return unsign(b.get(ind));
    }

    public static int getUByte(byte[] b, int ind) {
        return unsign(b[ind]);
    }

    public static int unsign(byte b) {
        return (b & 0xff);
    }
}

Related

  1. getTerminatedArray(ByteBuffer buf)
  2. getTriByte(ByteBuffer buf)
  3. getTruncatedInt(ByteBuffer bytes, int numBytes)
  4. getTsStartSyncByte(ByteBuffer packet, boolean synced)
  5. getTsSyncByte(ByteBuffer packet)
  6. getUleb128(ByteBuffer buffer)
  7. getUsedBytes(ByteBuffer bb)
  8. getUTF8FromByteBuffer(ByteBuffer bb)
  9. getUUID(ByteBuffer bytes)