public void BufferedStreamCopyWithNullOutputStream() { using (MemoryStream ms = new MemoryStream()) { Assert.That(() => StreamUtilities.BufferedStreamCopy(ms, null), Throws.ArgumentNullException); } }
public void BufferedStreamCopyWithNullOutputStream() { using (MemoryStream ms = new MemoryStream()) { StreamUtilities.BufferedStreamCopy(ms, null); } }
public void BufferedStreamCopyWithNullInputStream() { using (MemoryStream ms = new MemoryStream()) { StreamUtilities.BufferedStreamCopy(null, ms); } }
public override void Add(Stream filetoAdd, string fileName, DateTime modificationTime) { ZipEntry entry = zip.PutNextEntry(fileName); entry.ModifiedTime = modificationTime; //You have to do this because if using a memory stream the pointer will be at the end it //it's just been read and this will cause nothing to be written out filetoAdd.Position = 0; StreamUtilities.BufferedStreamCopy(filetoAdd, zip); zip.Flush(); }
public void BufferedStreamCopyWithValidData() { const string streamContents = "This is a test"; using (MemoryStream oms = new MemoryStream()) { using (MemoryStream ims = new MemoryStream(Encoding.ASCII.GetBytes(streamContents))) { StreamUtilities.BufferedStreamCopy(ims, oms); Assert.AreEqual(ims, oms); } } }
/// <summary> /// Read *from* this stream and write to the targetStream in a buffered manner as per the Read() /// </summary> /// <param name="targetStream">Stream to put data into</param> public void BufferedRead(Stream targetStream) { StreamUtilities.BufferedStreamCopy(this, targetStream); }
/// <summary> /// Write *to* this stream *from* the source stream in a buffered manner analogous to Write() /// </summary> /// <param name="sourceStream">Stream get data from</param> public void BufferedWrite(Stream sourceStream) { StreamUtilities.BufferedStreamCopy(sourceStream, this); }
public void BufferedStreamCopyWithNullOutputStream() { using (MemoryStream ms = new MemoryStream()) Assert.Throws(typeof(ArgumentNullException), () => StreamUtilities.BufferedStreamCopy(ms, null)); }