From 896c20671887175255e5db205a721165810cf32e Mon Sep 17 00:00:00 2001
From: diva
Date: Mon, 25 May 2009 19:20:27 +0000
Subject: One more utility. Not used yet.
---
OpenSim/Framework/Util.cs | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index ee47e0f..a188267 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -45,6 +45,7 @@ using log4net;
using Nini.Config;
using Nwc.XmlRpc;
using OpenMetaverse;
+using OpenMetaverse.StructuredData;
namespace OpenSim.Framework
{
@@ -1088,8 +1089,27 @@ namespace OpenSim.Framework
}
-
-
+ ///
+ /// Produces an OSDMap from its string representation on a stream
+ ///
+ /// The stream
+ /// The size of the data on the stream
+ /// The OSDMap or an exception
+ public static OSDMap GetOSDMap(Stream stream, int length)
+ {
+ byte[] data = new byte[length];
+ stream.Read(data, 0, length);
+ string strdata = Encoding.UTF8.GetString(data);
+ OSDMap args = null;
+ OSD buffer;
+ buffer = OSDParser.DeserializeJson(strdata);
+ if (buffer.Type == OSDType.Map)
+ {
+ args = (OSDMap)buffer;
+ return args;
+ }
+ return null;
+ }
}
}
--
cgit v1.1