-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
…rk. Base64 buffered works properly in the meantime. Added js vars clean up afte use. Added samples. Improved and fix documentation.
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,32 +13,11 @@ internal static class StreamExtensions | |
internal static byte[] ToByteArray(this Stream stream) | ||
{ | ||
var bytes = (stream as MemoryStream).ToArray(); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
stream.Flush(); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
arivera12
Owner
|
||
stream.Close(); | ||
This comment has been minimized.
Sorry, something went wrong.
Smurf-IV
|
||
stream.Dispose(); | ||
GC.Collect(1, GCCollectionMode.Forced); | ||
This comment has been minimized.
Sorry, something went wrong.
Smurf-IV
|
||
return bytes; | ||
} | ||
///// <summary> | ||
///// Converts a stream into a byte array | ||
///// </summary> | ||
///// <param name="stream">The stream</param> | ||
///// <param name="bufferSize">The buffer size</param> | ||
///// <returns></returns> | ||
//internal static byte[] ToByteArray(this Stream stream, int bufferSize) | ||
//{ | ||
// var buffer = new byte[bufferSize]; | ||
// for (int index = 0; index < ((int)(stream as MemoryStream).Length / bufferSize); index++) | ||
// { | ||
// yield return (byte)(stream as MemoryStream).get(buffer, 0, (int)stream.Length); | ||
// } | ||
// foreach (var bytes in (stream as MemoryStream).ReadByte(buffer, 0, (int)stream.Length)) | ||
// { | ||
|
||
// } | ||
// stream.Close(); | ||
// stream.Dispose(); | ||
// GC.Collect(1, GCCollectionMode.Forced); | ||
// return bytes; | ||
//} | ||
} | ||
} |
Need to check if it is a memory stream first, and default to another method if not.