예제 #1
0
        /** <inheritdoc /> */
        public byte[] ArrayCopy()
        {
            byte[] res = new byte[_mem.Length];

            fixed(byte *res0 = res)
            {
                PlatformMemoryUtils.CopyMemory(Data, res0, res.Length);
            }

            return(res);
        }
예제 #2
0
        /** <inheritdoc /> */

        public byte[] ReadByteArray(int cnt)
        {
            int curPos = EnsureReadCapacityAndShift(cnt);

            byte[] res = new byte[cnt];

            fixed(byte *res0 = res)
            {
                PlatformMemoryUtils.CopyMemory(Data + curPos, res0, cnt);
            }

            return(res);
        }
예제 #3
0
        /// <summary>
        /// Copy (write) some data from source and shift the stream forward.
        /// </summary>
        /// <param name="src">Source.</param>
        /// <param name="cnt">Bytes count.</param>
        private void CopyFromAndShift(byte *src, int cnt)
        {
            int curPos = EnsureWriteCapacityAndShift(cnt);

            PlatformMemoryUtils.CopyMemory(src, Data + curPos, cnt);
        }
예제 #4
0
        /// <summary>
        /// Copy (read) some data into destination and shift the stream forward.
        /// </summary>
        /// <param name="dest">Destination.</param>
        /// <param name="cnt">Bytes count.</param>
        private void CopyToAndShift(byte *dest, int cnt)
        {
            int curPos = EnsureReadCapacityAndShift(cnt);

            PlatformMemoryUtils.CopyMemory(Data + curPos, dest, cnt);
        }