public void Convert(Stream sourceStream, Stream destinationStream) { if (destinationStream == null) { throw new ArgumentNullException("destinationStream"); } Stream converter = new ConverterStream(sourceStream, this, ConverterStreamAccess.Read); var buf = new byte[outputBufferSize]; while (true) { var cnt = converter.Read(buf, 0, buf.Length); if (0 == cnt) { break; } destinationStream.Write(buf, 0, cnt); } destinationStream.Flush(); }
public void Convert(Stream sourceStream, Stream destinationStream) { if (destinationStream == null) { throw new ArgumentNullException("destinationStream"); } Stream stream = new ConverterStream(sourceStream, this, ConverterStreamAccess.Read); byte[] array = new byte[this.outputBufferSize]; for (;;) { int num = stream.Read(array, 0, array.Length); if (num == 0) { break; } destinationStream.Write(array, 0, num); } destinationStream.Flush(); }
/// <summary> /// Converts the specified source reader. /// </summary> /// <param name="sourceReader">The source reader.</param> /// <param name="destinationStream">The destination stream.</param> public void Convert(TextReader sourceReader, Stream destinationStream) { if (destinationStream == null) { throw new ArgumentNullException(nameof(destinationStream)); } Stream converter = new ConverterStream(sourceReader, this); byte[] buf = new byte[this.outputBufferSize]; while (true) { int cnt = converter.Read(buf, 0, buf.Length); if (0 == cnt) { break; } destinationStream.Write(buf, 0, cnt); } destinationStream.Flush(); }