public LongsRef next(int count) throws IOException {assert nextValues.length >= 0;assert count > 0;assert nextValues.offset + nextValues.length <= nextValues.longs.length;nextValues.offset += nextValues.length;final int remaining = valueCount - position - 1;if (remaining <= 0) {throw new EOFException();}count = Math.min(remaining, count);if (nextValues.offset == nextValues.longs.length) {final long remainingBlocks = format.byteCount(packedIntsVersion, remaining, bitsPerValue);final int blocksToRead = (int) Math.min(remainingBlocks, nextBlocks.length);in.readBytes(nextBlocks, 0, blocksToRead);if (blocksToRead < nextBlocks.length) {Arrays.fill(nextBlocks, blocksToRead, nextBlocks.length, (byte) 0);}bulkOperation.decode(nextBlocks, 0, nextValues.longs, 0, iterations);nextValues.offset = 0;}nextValues.length = Math.min(nextValues.longs.length - nextValues.offset, count);position += nextValues.length;return nextValues;}

public override Int64sRef Next(int count){Debug.Assert(nextValues.Length >= 0);Debug.Assert(count > 0);Debug.Assert(nextValues.Offset + nextValues.Length <= nextValues.Int64s.Length);nextValues.Offset += nextValues.Length;int remaining = m_valueCount - position - 1;if (remaining <= 0){throw new System.IO.EndOfStreamException();}count = Math.Min(remaining, count);if (nextValues.Offset == nextValues.Int64s.Length){long remainingBlocks = format.ByteCount(packedIntsVersion, remaining, m_bitsPerValue);int blocksToRead = (int)Math.Min(remainingBlocks, nextBlocks.Length);m_in.ReadBytes(nextBlocks, 0, blocksToRead);if (blocksToRead < nextBlocks.Length){Arrays.Fill(nextBlocks, blocksToRead, nextBlocks.Length, (byte)0);}bulkOperation.Decode(nextBlocks, 0, nextValues.Int64s, 0, iterations);nextValues.Offset = 0;}nextValues.Length = Math.Min(nextValues.Int64s.Length - nextValues.Offset, count);position += nextValues.Length;return nextValues;}
