aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Servers/Base
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Servers/Base')
-rw-r--r--OpenSim/Servers/Base/ServerUtils.cs21
1 files changed, 21 insertions, 0 deletions
diff --git a/OpenSim/Servers/Base/ServerUtils.cs b/OpenSim/Servers/Base/ServerUtils.cs
index b648e45..58d2b2b 100644
--- a/OpenSim/Servers/Base/ServerUtils.cs
+++ b/OpenSim/Servers/Base/ServerUtils.cs
@@ -25,6 +25,12 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
29using System.IO;
30using System.Xml;
31using System.Xml.Serialization;
32using System.Text;
33
28namespace OpenSim.Servers.AssetServer 34namespace OpenSim.Servers.AssetServer
29{ 35{
30 public static class ServerUtils 36 public static class ServerUtils
@@ -71,5 +77,20 @@ namespace OpenSim.Servers.AssetServer
71 return "application/octet-stream"; 77 return "application/octet-stream";
72 } 78 }
73 } 79 }
80
81 public static byte[] SerializeResult(XmlSerializer xs, object data)
82 {
83 MemoryStream ms = new MemoryStream();
84 XmlTextWriter xw = new XmlTextWriter(ms, Encoding.UTF8);
85 xw.Formatting = Formatting.Indented;
86 xs.Serialize(xw, data);
87 xw.Flush();
88
89 ms.Seek(0, SeekOrigin.Begin);
90 byte[] ret = ms.GetBuffer();
91 Array.Resize<byte>(ref ret, (int)ms.Length);
92
93 return ret;
94 }
74 } 95 }
75} 96}