code: private void readNextGroup() {
      try {
        int header = readUnsignedVarInt();
        this.mode = (header & 1) == 0 ? MODE.RLE : MODE.PACKED;
        switch (mode) {
          case RLE:
            this.currentCount = header >>> 1;
            this.currentValue = readIntLittleEndianPaddedOnBitWidth();
            return;
          case PACKED:
            int numGroups = header >>> 1;
            this.currentCount = numGroups * 8;
  
            if (this.currentBuffer.length < this.currentCount) {
              this.currentBuffer = new int[this.currentCount];
            }
            currentBufferIdx = 0;
            int valueIndex = 0;
            while (valueIndex < this.currentCount) {
              // values are bit packed 8 at a time, so reading bitWidth will always work
              ByteBuffer buffer = in.slice(bitWidth);
              this.packer.unpack8Values(buffer, buffer.position(), this.currentBuffer, valueIndex);
              valueIndex += 8;
            }
            return;
          default:
            throw new ParquetDecodingException("not a valid mode " + this.mode);
        }
      } catch (IOException e) {
        throw new ParquetDecodingException("Failed to read from input stream", e);
      }
    }
docs: Reads the next group.