Remember position of stream when outputting byte array
This commit is contained in:
parent
a7c047257d
commit
599a6bfe7f
@ -528,9 +528,13 @@ namespace UniversalEditor
|
||||
}
|
||||
public static byte[] ToByteArray(this System.IO.Stream stream)
|
||||
{
|
||||
long oldpos = stream.Position;
|
||||
|
||||
byte[] array = new byte[(int)((IntPtr)stream.Length)];
|
||||
stream.Position = 0L;
|
||||
stream.Read(array, 0, array.Length);
|
||||
|
||||
stream.Position = oldpos;
|
||||
return array;
|
||||
}
|
||||
#endregion
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user