Пример #1
0
 // inherit javadoc
 /// <exception cref="CloneNotSupportedException"/>
 public virtual object Clone()
 {
     Org.Apache.Hadoop.Record.Buffer result = (Org.Apache.Hadoop.Record.Buffer)base.MemberwiseClone
                                                  ();
     result.Copy(this.Get(), 0, this.GetCount());
     return(result);
 }
Пример #2
0
 /// <summary>Define the sort order of the Buffer.</summary>
 /// <param name="other">The other buffer</param>
 /// <returns>
 /// Positive if this is bigger than other, 0 if they are equal, and
 /// negative if this is smaller than other.
 /// </returns>
 public virtual int CompareTo(object other)
 {
     Org.Apache.Hadoop.Record.Buffer right = ((Org.Apache.Hadoop.Record.Buffer)other);
     byte[] lb = this.Get();
     byte[] rb = right.Get();
     for (int i = 0; i < count && i < right.count; i++)
     {
         int a = (lb[i] & unchecked ((int)(0xff)));
         int b = (rb[i] & unchecked ((int)(0xff)));
         if (a != b)
         {
             return(a - b);
         }
     }
     return(count - right.count);
 }