public static byte[] ToArray(Stream stream, int bufferSize) { MemoryStream memoryStream = stream as MemoryStream; if (memoryStream == null) { memoryStream = new MemoryStream(); StreamUtils.PumpStream(stream, memoryStream, bufferSize); } return(memoryStream.ToArray()); }
public static void PumpStream(Stream inputStream, Stream outputStream) { StreamUtils.PumpStream(inputStream, outputStream, 65536); }