private static int readRecordLength(ByteBuffer buffer,
                                        int offsetInBuffer) {
      int header = readHeader(buffer, offsetInBuffer);
      return extractRecordLength(header);
    }
private static int readRecordLength(ByteBuffer buffer,
                                        int offsetInBuffer)