public virtual byte[] Store(Stream input)
{
if (input == null) throw new ArgumentNullException("input");
if (!input.CanRead) throw new Exception("Input stream is not in a readable state.");
using (var s = this.OpenWriter())
{
byte[] buffer = new byte[BUFFERSIZE];
int readBytes;
while ((readBytes = input.Read(buffer, 0, BUFFERSIZE)) > 0)
s.Write(buffer, 0, readBytes);
return s.Commit();
}
}