ExternalBlobWriter IExternalBlobConnection.OpenWriter() { if (_openedStreams == null) { throw new Exception("The ExternalBlobConnection has been closed."); } ExternalBlobWriter w = OpenWriter(); _openedStreams.Add(new WeakReference(w)); return(w); }
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 (ExternalBlobWriter s = OpenWriter()) { var buffer = new byte[BufferSize]; int readBytes; while ((readBytes = input.Read(buffer, 0, BufferSize)) > 0) { s.Write(buffer, 0, readBytes); } return(s.Commit()); } }