summaryrefslogtreecommitdiffstats
path: root/SendGrid/SendGridMail/Utils.cs
diff options
context:
space:
mode:
Diffstat (limited to 'SendGrid/SendGridMail/Utils.cs')
-rwxr-xr-xSendGrid/SendGridMail/Utils.cs14
1 files changed, 14 insertions, 0 deletions
diff --git a/SendGrid/SendGridMail/Utils.cs b/SendGrid/SendGridMail/Utils.cs
index 31fe92f..c6f4386 100755
--- a/SendGrid/SendGridMail/Utils.cs
+++ b/SendGrid/SendGridMail/Utils.cs
@@ -28,5 +28,19 @@ namespace SendGridMail
return "{"+String.Join(",",dic.Select(kvp => Serialize(kvp.Key) + ":" + Serialize(kvp.Value)))+"}";
}
+ public static byte[] ReadFully(Stream input)
+ {
+ byte[] buffer = new byte[16*1024];
+ using (MemoryStream ms = new MemoryStream())
+ {
+ int read;
+ while ((read = input.Read(buffer, 0, buffer.Length)) > 0)
+ {
+ ms.Write(buffer, 0, read);
+ }
+ return ms.ToArray();
+ }
+ }
+
}
}