/// <summary>
 /// returns an address instance for prefix-compressed binary values.
 /// @lucene.internal
 /// </summary>
 protected internal virtual MonotonicBlockPackedReader GetIntervalInstance(IndexInput data, FieldInfo field, BinaryEntry bytes)
 {
     MonotonicBlockPackedReader addresses;
     long interval = bytes.AddressInterval;
     lock (AddressInstances)
     {
         MonotonicBlockPackedReader addrInstance;
         if (!AddressInstances.TryGetValue(field.Number, out addrInstance))
         {
             data.Seek(bytes.AddressesOffset);
             long size;
             if (bytes.Count % interval == 0)
             {
                 size = bytes.Count / interval;
             }
             else
             {
                 size = 1L + bytes.Count / interval;
             }
             addrInstance = new MonotonicBlockPackedReader(data, bytes.PackedIntsVersion, bytes.BlockSize, size, false);
             AddressInstances[field.Number] = addrInstance;
             RamBytesUsed_Renamed.AddAndGet(addrInstance.RamBytesUsed() + RamUsageEstimator.NUM_BYTES_INT);
         }
         addresses = addrInstance;
     }
     return addresses;
 }
 /// <summary>
 /// returns an address instance for sortedset ordinal lists
 /// @lucene.internal
 /// </summary>
 protected internal virtual MonotonicBlockPackedReader GetOrdIndexInstance(IndexInput data, FieldInfo field, NumericEntry entry)
 {
     MonotonicBlockPackedReader ordIndex;
     lock (OrdIndexInstances)
     {
         MonotonicBlockPackedReader ordIndexInstance;
         if (!OrdIndexInstances.TryGetValue(field.Number, out ordIndexInstance))
         {
             data.Seek(entry.Offset);
             ordIndexInstance = new MonotonicBlockPackedReader(data, entry.PackedIntsVersion, entry.BlockSize, entry.Count, false);
             OrdIndexInstances[field.Number] = ordIndexInstance;
             RamBytesUsed_Renamed.AddAndGet(ordIndexInstance.RamBytesUsed() + RamUsageEstimator.NUM_BYTES_INT);
         }
         ordIndex = ordIndexInstance;
     }
     return ordIndex;
 }
 private BinaryDocValues LoadBinary(FieldInfo field)
 {
     BinaryEntry entry = Binaries[field.Number];
     Data.Seek(entry.Offset);
     PagedBytes bytes = new PagedBytes(16);
     bytes.Copy(Data, entry.NumBytes);
     PagedBytes.Reader bytesReader = bytes.Freeze(true);
     if (entry.MinLength == entry.MaxLength)
     {
         int fixedLength = entry.MinLength;
         RamBytesUsed_Renamed.AddAndGet(bytes.RamBytesUsed());
         return new BinaryDocValuesAnonymousInnerClassHelper(bytesReader, fixedLength);
     }
     else
     {
         MonotonicBlockPackedReader addresses = new MonotonicBlockPackedReader(Data, entry.PackedIntsVersion, entry.BlockSize, MaxDoc, false);
         RamBytesUsed_Renamed.AddAndGet(bytes.RamBytesUsed() + addresses.RamBytesUsed());
         return new BinaryDocValuesAnonymousInnerClassHelper2(bytesReader, addresses);
     }
 }