Here you can find the source of readUnsignedMedium(ByteBuffer buf)
Parameter | Description |
---|---|
buf | The buffer. |
public static int readUnsignedMedium(ByteBuffer buf)
//package com.java2s; //License from project: Apache License import java.nio.ByteBuffer; public class Main { /**//w w w . j a va 2 s . c o m * Gets a smart. * @param buf The buffer. * @return The smart. */ public static int readUnsignedMedium(ByteBuffer buf) { int peek = buf.get(buf.position()) & 0xFF; if (peek < 128) { return buf.get() & 0xFF; } else { return (buf.getShort() & 0xFFFF) - 32768; } } }