Software components for data protection, secure storage and transfer
// Read the source file into a byte array.
var bytes = new byte[stream.Length];
var numBytesToRead = (int)stream.Length;
var numBytesRead = 0;
while (numBytesToRead > 0)
// Read may return anything from 0 to numBytesToRead.
int n = stream.Read(bytes, numBytesRead, numBytesToRead);
// Break when the end of the file is reached.
if (n == 0)
numBytesRead += n;
numBytesToRead -= n;
Copyright (c) 2017, /n software, inc.
As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.