[Modify] Polish it
This commit is contained in:
@@ -706,10 +706,11 @@ namespace WebSocketSharp
|
|||||||
return buff;
|
return buff;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static byte[] ReadBytes (this Stream stream, long length, int bufferLength)
|
internal static byte[] ReadBytes (
|
||||||
|
this Stream stream, long length, int bufferLength
|
||||||
|
)
|
||||||
{
|
{
|
||||||
using (var dest = new MemoryStream ()) {
|
using (var dest = new MemoryStream ()) {
|
||||||
try {
|
|
||||||
var buff = new byte[bufferLength];
|
var buff = new byte[bufferLength];
|
||||||
var nread = 0;
|
var nread = 0;
|
||||||
while (length > 0) {
|
while (length > 0) {
|
||||||
@@ -723,9 +724,6 @@ namespace WebSocketSharp
|
|||||||
dest.Write (buff, 0, nread);
|
dest.Write (buff, 0, nread);
|
||||||
length -= nread;
|
length -= nread;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch {
|
|
||||||
}
|
|
||||||
|
|
||||||
dest.Close ();
|
dest.Close ();
|
||||||
return dest.ToArray ();
|
return dest.ToArray ();
|
||||||
|
|||||||
Reference in New Issue
Block a user