Write() публичный статический Метод

Write the provided input stream to the destination stream
public static Write ( Stream inputStream, Stream destinationStream ) : double
inputStream Stream Input stream containing data to send
destinationStream Stream The destination stream
Результат double
Пример #1
0
 /// <summary>
 /// Return the MD5 hash of part of the current <see cref="ThreadSafeStream"/> as a string
 /// </summary>
 /// <param name="start">The start position in the stream</param>
 /// <param name="length">The length of stream to MD5</param>
 /// <returns></returns>
 public string MD5(long start, int length)
 {
     using (MemoryStream partialStream = new MemoryStream(length))
     {
         lock (streamLocker)
         {
             StreamTools.Write(_innerStream, start, length, partialStream, 8000, 1000, 500);
             return(StreamTools.MD5(partialStream));
         }
     }
 }
Пример #2
0
        /// <summary>
        /// Return the MD5 hash of the provided memory stream as a string. Stream position will be equal to the length of stream on
        /// return, this ensures the MD5 is consistent.
        /// </summary>
        /// <param name="streamToMD5">The bytes which will be checksummed</param>
        /// <param name="start">The start position in the stream</param>
        /// <param name="length">The length in the stream to MD5</param>
        /// <returns>The MD5 checksum as a string</returns>
        public static string MD5(Stream streamToMD5, long start, int length)
        {
            if (streamToMD5 == null)
            {
                throw new ArgumentNullException("streamToMD5", "Provided Stream cannot be null.");
            }

            using (MemoryStream stream = new MemoryStream(length))
            {
                StreamTools.Write(streamToMD5, start, length, stream, 8000, 100, 2000);
                return(MD5(stream));
            }
        }
Пример #3
0
 /// <summary>
 /// Copies data specified by start and length properties from internal stream to the provided stream.
 /// </summary>
 /// <param name="destinationStream">The destination stream to write to</param>
 /// <param name="startPosition"></param>
 /// <param name="length"></param>
 /// <param name="writeBufferSize">The buffer size to use for copying stream contents</param>
 /// <param name="minTimeoutMS">The minimum time allowed for any sized copy</param>
 /// <param name="timeoutMSPerKBWrite">The timouts in milliseconds per KB to write</param>
 /// <returns>The average time in milliseconds per byte written</returns>
 public double CopyTo(Stream destinationStream, long startPosition, long length, int writeBufferSize, double timeoutMSPerKBWrite = 1000, int minTimeoutMS = 500)
 {
     lock (streamLocker)
         return(StreamTools.Write(_innerStream, startPosition, length, destinationStream, writeBufferSize, timeoutMSPerKBWrite, minTimeoutMS));
 }