public static void Copy(EndianReader input, EndianWriter output) { // http://stackoverflow.com/questions/230128/best-way-to-copy-between-two-stream-instances-c-sharp const int BufferSize = 0x1000; byte[] buffer = new byte[BufferSize]; int read; while ((read = input.ReadBlock(buffer, 0, BufferSize)) > 0) output.WriteBlock(buffer, 0, read); }
public static void Copy(EndianReader input, EndianWriter output, int size) { const int BufferSize = 0x1000; byte[] buffer = new byte[BufferSize]; while (size > 0) { int read = input.ReadBlock(buffer, 0, Math.Min(BufferSize, size)); output.WriteBlock(buffer, 0, read); size -= BufferSize; } }