We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1a7c445 commit 6c74b1eCopy full SHA for 6c74b1e
Ghostscript.NET/Helpers/StreamHelper.cs
@@ -148,13 +148,32 @@ public static string WriteToTemporaryFile(Stream stream)
148
149
using (FileStream fs = File.Create(path))
150
{
151
- stream.CopyTo(fs);
+ CopyStream(stream, fs);
152
}
153
154
return path;
155
156
157
#endregion
158
159
+ #region CopyStream
160
+
161
+ public static void CopyStream(Stream input, Stream output)
162
+ {
163
+ int size = (input.CanSeek) ? Math.Min((int)(input.Length - input.Position), 0x2000) : 0x2000;
164
165
+ byte[] buffer = new byte[size];
166
167
+ int n;
168
169
+ do
170
171
+ n = output.Read(buffer, 0, buffer.Length);
172
+ output.Write(buffer, 0, n);
173
+ } while (n != 0);
174
+ }
175
176
+ #endregion
177
178
179
0 commit comments