aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Util.cs
diff options
context:
space:
mode:
authorMelanie2012-09-16 04:11:20 +0100
committerMelanie2012-09-16 04:11:20 +0100
commitdb774d4292588db1e2ac4a9fafe977ddbec353ee (patch)
tree5fc381d7cb96cc0d2b47e4807821f488c339ec13 /OpenSim/Framework/Util.cs
parentMerge branch 'avination' into careminster (diff)
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-db774d4292588db1e2ac4a9fafe977ddbec353ee.zip
opensim-SC_OLD-db774d4292588db1e2ac4a9fafe977ddbec353ee.tar.gz
opensim-SC_OLD-db774d4292588db1e2ac4a9fafe977ddbec353ee.tar.bz2
opensim-SC_OLD-db774d4292588db1e2ac4a9fafe977ddbec353ee.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs OpenSim/Region/Framework/Scenes/EventManager.cs
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r--OpenSim/Framework/Util.cs32
1 files changed, 32 insertions, 0 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 1a383ae..a26e930 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1019,6 +1019,38 @@ namespace OpenSim.Framework
1019 } 1019 }
1020 } 1020 }
1021 1021
1022 /// <summary>
1023 /// Copy data from one stream to another, leaving the read position of both streams at the beginning.
1024 /// </summary>
1025 /// <param name='inputStream'>
1026 /// Input stream. Must be seekable.
1027 /// </param>
1028 /// <exception cref='ArgumentException'>
1029 /// Thrown if the input stream is not seekable.
1030 /// </exception>
1031 public static Stream Copy(Stream inputStream)
1032 {
1033 if (!inputStream.CanSeek)
1034 throw new ArgumentException("Util.Copy(Stream inputStream) must receive an inputStream that can seek");
1035
1036 const int readSize = 256;
1037 byte[] buffer = new byte[readSize];
1038 MemoryStream ms = new MemoryStream();
1039
1040 int count = inputStream.Read(buffer, 0, readSize);
1041
1042 while (count > 0)
1043 {
1044 ms.Write(buffer, 0, count);
1045 count = inputStream.Read(buffer, 0, readSize);
1046 }
1047
1048 ms.Position = 0;
1049 inputStream.Position = 0;
1050
1051 return ms;
1052 }
1053
1022 public static XmlRpcResponse XmlRpcCommand(string url, string methodName, params object[] args) 1054 public static XmlRpcResponse XmlRpcCommand(string url, string methodName, params object[] args)
1023 { 1055 {
1024 return SendXmlRpcCommand(url, methodName, args); 1056 return SendXmlRpcCommand(url, methodName, args);