Java ByteBuffer to Int toInt(ByteBuffer value)

Here you can find the source of toInt(ByteBuffer value)

Description

to Int

License

Open Source License

Declaration

public static int toInt(ByteBuffer value) 

Method Source Code

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

import java.nio.ByteBuffer;

public class Main {
    public static int toInt(ByteBuffer value) {
        int result = 0;
        try {//w  w  w . j a  va 2  s  . co m
            if (value != null) {
                int originPos = value.position();
                result = value.getInt();
                value.position(originPos);
            }
        } catch (Exception ex) {
            // ex.printStackTrace();
        }
        return result;
    }
}

Related

  1. readVarInt(ByteBuffer stream)
  2. readVarIntRest(ByteBuffer buff, int b)
  3. toInt(ByteBuffer buffer)
  4. toInt(ByteBuffer buffer)
  5. toInt(ByteBuffer bytes)
  6. toInt16BE(ByteBuffer buf, int[] out)