Exemple #1
0
 /// <summary>Read raw bytes from a SequenceFile.</summary>
 /// <exception cref="System.IO.IOException"/>
 /// <exception cref="System.Exception"/>
 public override bool NextKeyValue()
 {
     lock (this)
     {
         if (done)
         {
             return(false);
         }
         long pos = @in.GetPosition();
         bool eof = -1 == @in.NextRawKey(buffer);
         if (!eof)
         {
             if (key == null)
             {
                 key = new BytesWritable();
             }
             if (value == null)
             {
                 value = new BytesWritable();
             }
             key.Set(buffer.GetData(), 0, buffer.GetLength());
             buffer.Reset();
             @in.NextRawValue(vbytes);
             vbytes.WriteUncompressedBytes(buffer);
             value.Set(buffer.GetData(), 0, buffer.GetLength());
             buffer.Reset();
         }
         return(!(done = (eof || (pos >= end && @in.SyncSeen()))));
     }
 }
Exemple #2
0
 /// <summary>Read raw bytes from a SequenceFile.</summary>
 /// <exception cref="System.IO.IOException"/>
 public virtual bool Next(BytesWritable key, BytesWritable val)
 {
     lock (this)
     {
         if (done)
         {
             return(false);
         }
         long pos = @in.GetPosition();
         bool eof = -1 == @in.NextRawKey(buffer);
         if (!eof)
         {
             key.Set(buffer.GetData(), 0, buffer.GetLength());
             buffer.Reset();
             @in.NextRawValue(vbytes);
             vbytes.WriteUncompressedBytes(buffer);
             val.Set(buffer.GetData(), 0, buffer.GetLength());
             buffer.Reset();
         }
         return(!(done = (eof || (pos >= end && @in.SyncSeen()))));
     }
 }