CmisSync.Lib.FileTransmission.ContentTaskUtils.PrepareResume C# (CSharp) Метод

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

Prepares to resume.
public static PrepareResume ( long successfulLength, Stream successfulPart, HashAlgorithm hashAlg ) : void
successfulLength long Successful length.
successfulPart Stream Successful part.
hashAlg System.Security.Cryptography.HashAlgorithm Hash algorithm
Результат void
        public static void PrepareResume(long successfulLength, Stream successfulPart, HashAlgorithm hashAlg) {
            byte[] buffer = new byte[4096];
            int pos = 0;
            while (pos < successfulLength) {
                int l = successfulPart.Read(buffer, 0, (int)Math.Min(buffer.Length, successfulLength - pos));
                if (l <= 0) {
                    throw new IOException(string.Format("File stream is shorter ({0}) than the given length {1}", pos, successfulLength));
                }

                hashAlg.TransformBlock(buffer, 0, l, buffer, 0);
                pos += l;
            }
        }