Exemple #1
0
        protected bool Equals(ByteBuffer other)
        {
            if (this.Remaining() != other.Remaining())
            {
                return(false);
            }

            int p = (int)this.Position;

            for (int i = this.Limit() - 1, j = other.Limit() - 1; i >= p; i--, j--)
            {
                if (!Equals(this.Get(i), other.Get(j)))
                {
                    return(false);
                }
            }

            return(true);
        }
Exemple #2
0
        public ByteBuffer Put(ByteBuffer src)
        {
            if (ReferenceEquals(src, this))
            {
                throw new ArgumentNullException("src");
            }

            int n = src.Remaining();

            if (n > this.Remaining())
            {
                throw new IndexOutOfRangeException();
            }

            Buffer.BlockCopy(src.hb, src.Ix(src.position), this.hb, this.Ix(this.position), n);
            this.position += n;
            src.position  += n;

            return(this);
        }