Ejemplo n.º 1
0
 static void ProcessInput(RawRecordReader reader, String idRegex, String recordHas, HashSet <String> idsLookedFor)
 {
     while (reader.HasNext())
     {
         RawRecord rec = reader.Next();
         String    id  = rec.GetRecordId();
         if ((idsLookedFor == null && recordHas == null && Regex.IsMatch(id, idRegex)) ||
             (idsLookedFor != null && idsLookedFor.Contains(id)))
         {
             byte[] recordBytes = rec.GetRecordBytes();
             Console.Write(recordBytes);
             Console.WriteLine();
         }
         else if (idsLookedFor == null && idRegex == null && recordHas != null)
         {
             String tag   = recordHas.Substring(0, 3);
             String field = rec.GetFieldVal(tag);
             if (field != null)
             {
                 byte[] recordBytes = rec.GetRecordBytes();
                 Console.Write(recordBytes);
                 Console.WriteLine();
             }
         }
     }
 }
Ejemplo n.º 2
0
 static void PrintIds(RawRecordReader reader)
 {
     while (reader.HasNext())
     {
         RawRecord rec = reader.Next();
         String    id  = rec.GetRecordId();
         Console.WriteLine(id);
     }
 }
Ejemplo n.º 3
0
 public bool HasNext()
 {
     if (nextRec == null)
     {
         nextRec = new RawRecord(input);
     }
     if (nextRec != null && nextRec.GetRecordBytes() != null)
     {
         if (afterNextRec == null)
         {
             afterNextRec = new RawRecord(input);
             if (mergeRecords)
             {
                 while (afterNextRec != null && afterNextRec.GetRecordBytes() != null && afterNextRec.GetRecordId().Equals(nextRec.GetRecordId()))
                 {
                     nextRec      = new RawRecord(nextRec, afterNextRec);
                     afterNextRec = new RawRecord(input);
                 }
             }
         }
         return(true);
     }
     return(false);
 }