예제 #1
0
        public override CharBuffer Put(char[] src, int offset, int length)
        {
            if (((long)length << 1) > Bits.JNI_COPY_FROM_ARRAY_THRESHOLD)
            {
                CheckBounds(offset, length, src.Length);
                int pos = Position();
                int lim = Limit();
                assert(pos <= lim);
                int rem = (pos <= lim ? lim - pos : 0);
                if (length > rem)
                {
                    throw new BufferOverflowException();
                }


                if (Order() != ByteOrder.NativeOrder())
                {
                    Bits.CopyFromCharArray(src, (long)offset << 1, Ix(pos), (long)length << 1);
                }
                else

                {
                    Bits.CopyFromArray(src, ArrayBaseOffset, (long)offset << 1, Ix(pos), (long)length << 1);
                }
                Position(pos + length);
            }
            else
            {
                base.Put(src, offset, length);
            }
            return(this);
        }