/// <exception cref="System.IO.IOException"/>
 public virtual bool Next(K key, V value)
 {
     lock (this)
     {
         if (!more)
         {
             return(false);
         }
         long pos       = @in.GetPosition();
         bool remaining = (@in.Next(key) != null);
         if (remaining)
         {
             GetCurrentValue(value);
         }
         if (pos >= end && @in.SyncSeen())
         {
             more = false;
         }
         else
         {
             more = remaining;
         }
         return(more);
     }
 }
Ejemplo n.º 2
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()))));
     }
 }
        /// <exception cref="System.IO.IOException"/>
        /// <exception cref="System.Exception"/>
        public override bool NextKeyValue()
        {
            if (!more)
            {
                return(false);
            }
            long pos = @in.GetPosition();

            key = (K)@in.Next(key);
            if (key == null || (pos >= end && @in.SyncSeen()))
            {
                more  = false;
                key   = null;
                value = null;
            }
            else
            {
                value = (V)@in.GetCurrentValue(value);
            }
            return(more);
        }
Ejemplo n.º 4
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()))));
     }
 }