CmisSync.Lib.Sync.CmisRepo.SynchronizedFolder.DownloadStream C# (CSharp) Метод

DownloadStream() приватный Метод

Download a file, without retrying.
private DownloadStream ( DotCMIS contentStream, string filePath ) : byte[]
contentStream DotCMIS
filePath string
Результат byte[]
            private byte[] DownloadStream(DotCMIS.Data.IContentStream contentStream, string filePath)
            {
                byte[] hash = { };
                using (Stream file = File.OpenWrite(filePath))
                using (SHA1 hashAlg = new SHA1Managed())
                using (CryptoStream hashstream = new CryptoStream(file, hashAlg, CryptoStreamMode.Write))
                {
                    byte[] buffer = new byte[8 * 1024];
                    int len;
                    while ((len = contentStream.Stream.Read(buffer, 0, buffer.Length)) > 0)
                    {
                        hashstream.Write(buffer, 0, len);
                    }
                    hashstream.FlushFinalBlock();
                    hash = hashAlg.Hash;
                }
                contentStream.Stream.Close();
                return hash;
            }