WriteBytes() public static method

Write several whole bytes
public static WriteBytes ( byte source, int sourceByteOffset, int numberOfBytes, byte destination, int destBitOffset ) : void
source byte
sourceByteOffset int
numberOfBytes int
destination byte
destBitOffset int
return void
        /// <summary>
        /// Writes the specified number of bytes from an array
        /// </summary>
        public void Write(byte[] source, int offsetInBytes, int numberOfBytes)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            int bits = numberOfBytes * 8;

            EnsureBufferSize(m_bitLength + bits);
            NetBitWriter.WriteBytes(source, offsetInBytes, numberOfBytes, m_data, m_bitLength);
            m_bitLength += bits;
        }
        /// <summary>
        /// Writes all bytes in an array
        /// </summary>
        public void Write(byte[] source)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            int bits = source.Length * 8;

            EnsureBufferSize(m_bitLength + bits);
            NetBitWriter.WriteBytes(source, 0, source.Length, m_data, m_bitLength);
            m_bitLength += bits;
        }
        public unsafe void Write(byte *pSource, int offsetInBytes, int numberOfBytes)
        {
            if (pSource == null)
            {
                throw new ArgumentNullException(nameof(pSource));
            }
            var bits = numberOfBytes * 8;

            EnsureBufferSize(m_bitLength + bits);
            NetBitWriter.WriteBytes(pSource, offsetInBytes, numberOfBytes, m_data, m_bitLength);
            m_bitLength += bits;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Writes all bytes in an array.
        /// </summary>
        public void Write(ReadOnlySpan <byte> source)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            int bits = source.Length * 8;

            EnsureBufferSize(m_bitLength + bits);
            NetBitWriter.WriteBytes(source, 0, source.Length, m_data, m_bitLength);
            m_bitLength += bits;
        }
        public unsafe void Write(byte *pSource, int length)
        {
            if (pSource == null)
            {
                throw new ArgumentNullException(nameof(pSource));
            }
            var bits = length * 8;

            EnsureBufferSize(m_bitLength + bits);
            NetBitWriter.WriteBytes(pSource, 0, length, m_data, m_bitLength);
            m_bitLength += bits;
        }