readVarint32Buf method

int readVarint32Buf(
  1. ByteBuffer frame
)

Implementation

int readVarint32Buf(nio.ByteBuffer frame) {
  int result = 0;
  int shift = 0;

  while (true) {
    int b = frame.get();
    result |= (b & 0x7f) << shift;
    if ((b & 0x80) != 0x80) {
      break;
    }
    shift += 7;
  }

  return result;
}