NHibernate.Lob.External.AbstractExternalBlobConnection.ReadInto C# (CSharp) Method

ReadInto() public method

public ReadInto ( byte blobIdentifier, Stream output ) : void
blobIdentifier byte
output Stream
return void
		public void ReadInto(byte[] blobIdentifier, Stream output)
		{
			if (blobIdentifier == null) throw new ArgumentNullException("blobIdentifier");
			if (output == null) throw new ArgumentNullException("output");
			if (!output.CanWrite) throw new Exception("Output stream is not in a writable state.");
			using (var s = this.OpenReader(blobIdentifier))
			{
				byte[] buffer = new byte[BUFFERSIZE];
				int readBytes;
				while ((readBytes = s.Read(buffer, 0, BUFFERSIZE)) > 0)
				{
					output.Write(buffer, 0, readBytes);
				}
			}
		}