Esempio n. 1
0
        public virtual java.nio.ByteBuffer put(java.nio.ByteBuffer src)
        {
            if (src == this)
            {
                throw new System.ArgumentException("src == this");
            }
            int srcByteCount = src.remaining();

            if (srcByteCount > remaining())
            {
                throw new java.nio.BufferOverflowException();
            }
            if (src.isDirect())
            {
                throw new System.InvalidOperationException();
            }
            byte[] srcObject = java.nio.NioUtils.unsafeArray(src);
            int    srcOffset = src.position();

            if (!src.isDirect())
            {
                srcOffset += java.nio.NioUtils.unsafeArrayOffset(src);
            }
            java.nio.ByteBuffer dst = this;
            if (dst.isDirect())
            {
                throw new System.InvalidOperationException();
            }
            byte[] dstObject = java.nio.NioUtils.unsafeArray(dst);
            int    dstOffset = dst.position();

            if (!dst.isDirect())
            {
                dstOffset += java.nio.NioUtils.unsafeArrayOffset(dst);
            }
            System.Array.Copy(srcObject, srcOffset, dstObject, dstOffset, srcByteCount);
            src.position(src.limit());
            dst.position(dst.position() + srcByteCount);
            return(this);
        }
 public override bool isDirect()
 {
     return(byteBuffer.isDirect());
 }