public override void lookupOrd(long ord, BytesRef result)
 {
     try
     {
         if (ord < 0 || ord >= field.numValues)
         {
             throw new System.IndexOutOfRangeException("ord must be 0 .. " + (field.numValues - 1) + "; got " + ord);
         }
         @in.seek(field.dataStartFilePointer + ord * (9 + field.pattern.Length + field.maxLength));
         SimpleTextUtil.ReadLine(@in, scratch);
         Debug.Assert(StringHelper.StartsWith(scratch, LENGTH), "got " + scratch.utf8ToString() + " in=" + @in);
         int len;
         try
         {
             len = (int)decoder.parse(new string(scratch.bytes, scratch.offset + LENGTH.length, scratch.length - LENGTH.length, StandardCharsets.UTF_8));
         }
         catch (ParseException pe)
         {
             CorruptIndexException e = new CorruptIndexException("failed to parse int length (resource=" + @in + ")");
             e.initCause(pe);
             throw e;
         }
         result.bytes  = new sbyte[len];
         result.offset = 0;
         result.length = len;
         @in.readBytes(result.bytes, 0, len);
     }
     catch (IOException ioe)
     {
         throw new Exception(ioe);
     }
 }
 public override int getOrd(int docID)
 {
     if (docID < 0 || docID >= outerInstance.maxDoc)
     {
         throw new System.IndexOutOfRangeException("docID must be 0 .. " + (outerInstance.maxDoc - 1) + "; got " + docID);
     }
     try
     {
         @in.seek(field.dataStartFilePointer + field.numValues * (9 + field.pattern.Length + field.maxLength) + docID * (1 + field.ordPattern.Length));
         SimpleTextUtil.ReadLine(@in, scratch);
         try
         {
             return((long)(int)ordDecoder.parse(scratch.utf8ToString()) - 1);
         }
         catch (ParseException pe)
         {
             CorruptIndexException e = new CorruptIndexException("failed to parse ord (resource=" + @in + ")");
             e.initCause(pe);
             throw e;
         }
     }
     catch (IOException ioe)
     {
         throw new Exception(ioe);
     }
 }
 public override void get(int docID, BytesRef result)
 {
     try
     {
         if (docID < 0 || docID >= outerInstance.maxDoc)
         {
             throw new System.IndexOutOfRangeException("docID must be 0 .. " + (outerInstance.maxDoc - 1) + "; got " + docID);
         }
         @in.seek(field.dataStartFilePointer + (9 + field.pattern.Length + field.maxLength + 2) * docID);
         SimpleTextUtil.ReadLine(@in, scratch);
         Debug.Assert(StringHelper.StartsWith(scratch, LENGTH));
         int len;
         try
         {
             len = (int)decoder.parse(new string(scratch.bytes, scratch.offset + LENGTH.length, scratch.length - LENGTH.length, StandardCharsets.UTF_8));
         }
         catch (ParseException pe)
         {
             CorruptIndexException e = new CorruptIndexException("failed to parse int length (resource=" + @in + ")");
             e.initCause(pe);
             throw e;
         }
         result.bytes  = new sbyte[len];
         result.offset = 0;
         result.length = len;
         @in.readBytes(result.bytes, 0, len);
     }
     catch (IOException ioe)
     {
         throw new Exception(ioe);
     }
 }
 public override bool get(int index)
 {
     try
     {
         @in.seek(field.dataStartFilePointer + (9 + field.pattern.Length + field.maxLength + 2) * index);
         SimpleTextUtil.ReadLine(@in, scratch);
         Debug.Assert(StringHelper.StartsWith(scratch, LENGTH));
         int len;
         try
         {
             len = (int)decoder.parse(new string(scratch.bytes, scratch.offset + LENGTH.length, scratch.length - LENGTH.length, StandardCharsets.UTF_8));
         }
         catch (ParseException pe)
         {
             CorruptIndexException e = new CorruptIndexException("failed to parse int length (resource=" + @in + ")");
             e.initCause(pe);
             throw e;
         }
         // skip past bytes
         sbyte[] bytes = new sbyte[len];
         @in.readBytes(bytes, 0, len);
         SimpleTextUtil.ReadLine(@in, scratch);       // newline
         SimpleTextUtil.ReadLine(@in, scratch);       // 'T' or 'F'
         return(scratch.bytes[scratch.offset] == (sbyte)'T');
     }
     catch (IOException ioe)
     {
         throw new Exception(ioe);
     }
 }
 public override long get(int docID)
 {
     try
     {
         //System.out.println(Thread.currentThread().getName() + ": get docID=" + docID + " in=" + in);
         if (docID < 0 || docID >= outerInstance.maxDoc)
         {
             throw new System.IndexOutOfRangeException("docID must be 0 .. " + (outerInstance.maxDoc - 1) + "; got " + docID);
         }
         @in.seek(field.dataStartFilePointer + (1 + field.pattern.Length + 2) * docID);
         SimpleTextUtil.ReadLine(@in, scratch);
         //System.out.println("parsing delta: " + scratch.utf8ToString());
         decimal bd;
         try
         {
             bd = (decimal)decoder.parse(scratch.utf8ToString());
         }
         catch (ParseException pe)
         {
             CorruptIndexException e = new CorruptIndexException("failed to parse BigDecimal value (resource=" + @in + ")");
             e.initCause(pe);
             throw e;
         }
         SimpleTextUtil.ReadLine(@in, scratch);       // read the line telling us if its real or not
         return(System.Numerics.BigInteger.valueOf(field.minValue) + (long)bd.toBigIntegerExact());
     }
     catch (IOException ioe)
     {
         throw new Exception(ioe);
     }
 }