Write() public method

Writes the specified buffer.
public Write ( byte buffer, int offset, int count ) : void
buffer byte The buffer.
offset int The offset.
count int The count.
return void
Beispiel #1
0
 public void WriteTest()
 {
     Stream stream = null; // TODO: Initialize to an appropriate value
     CompressionMode mode = new CompressionMode(); // TODO: Initialize to an appropriate value
     ZlibStream target = new ZlibStream(stream, mode); // TODO: Initialize to an appropriate value
     byte[] buffer = null; // TODO: Initialize to an appropriate value
     int offset = 0; // TODO: Initialize to an appropriate value
     int count = 0; // TODO: Initialize to an appropriate value
     target.Write(buffer, offset, count);
     Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }
Beispiel #2
0
        /// <summary>
        /// Compresses the specified data.
        /// </summary>
        /// <param name="data">Data to compress.</param>
        /// <param name="offset">The zero-based byte offset in <paramref name="data"/> at which to begin reading the data to compress. </param>
        /// <param name="length">The number of bytes to be compressed. </param>
        /// <returns>
        /// The compressed data.
        /// </returns>
        public virtual byte[] Compress(byte[] data, int offset, int length)
        {
            if (!IsActive)
            {
                if (offset == 0 && length == data.Length)
                {
                    return(data);
                }

                var buffer = new byte[length];
                Buffer.BlockCopy(data, offset, buffer, 0, length);
                return(buffer);
            }

            _compressorStream.SetLength(0);

            _compressor.Write(data, offset, length);

            return(_compressorStream.ToArray());
        }