Java ByteBuffer Read readBE(ByteBuffer bb, int elementWidth)

Here you can find the source of readBE(ByteBuffer bb, int elementWidth)

Description

read BE

License

Open Source License

Declaration

private static long readBE(ByteBuffer bb, int elementWidth) 

Method Source Code


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

import java.nio.ByteBuffer;

public class Main {
    private static long readBE(ByteBuffer bb, int elementWidth) {
        final int p = bb.position();
        long value = 0;
        for (int j = 0; j < elementWidth; j++) {
            value = (value << 8) | (bb.get(p + j) & 0xff);
        }/* w w w.  jav a 2  s  .  c o  m*/
        bb.position(p + elementWidth);
        return value;
    }
}

Related

  1. readableBytes(ByteBuffer buffer)
  2. readAlexString(ByteBuffer buffer)
  3. readAllLeftBytes(ByteBuffer buffer)
  4. readASCII(ByteBuffer buffer)
  5. readAsciiString(MappedByteBuffer buffer, int pos, int length)
  6. readBoolean(ByteBuffer buff)
  7. readBooleanArray(ByteBuffer in)
  8. readBuf(ByteBuffer buffer)
  9. readBuffer(ByteChannel channel, ByteBuffer buffer)