activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r512252 - in /activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/OpenWire: EndianSupport.cs OpenWireBinaryReader.cs OpenWireBinaryWriter.cs
Date Tue, 27 Feb 2007 13:43:54 GMT
Author: jstrachan
Date: Tue Feb 27 05:43:49 2007
New Revision: 512252

URL: http://svn.apache.org/viewvc?view=rev&rev=512252
Log:
fix for AMQNET-9

Modified:
    activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/OpenWire/EndianSupport.cs
    activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/OpenWire/OpenWireBinaryReader.cs
    activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/OpenWire/OpenWireBinaryWriter.cs

Modified: activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/OpenWire/EndianSupport.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/OpenWire/EndianSupport.cs?view=diff&rev=512252&r1=512251&r2=512252
==============================================================================
--- activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/OpenWire/EndianSupport.cs (original)
+++ activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/OpenWire/EndianSupport.cs Tue
Feb 27 05:43:49 2007
@@ -102,8 +102,21 @@
             bw.Flush();
             ms = new MemoryStream(SwitchEndian(ms.ToArray()));
             BinaryReader br = new BinaryReader(ms);
-            return br.ReadDouble();           
+            return br.ReadDouble();
         }
+
+		
+        public static float SwitchEndian(float x)
+        {
+            MemoryStream ms = new MemoryStream();
+            BinaryWriter bw = new BinaryWriter(ms);
+            bw.Write(x);
+            bw.Flush();
+            ms = new MemoryStream(SwitchEndian(ms.ToArray()));
+            BinaryReader br = new BinaryReader(ms);
+            return br.ReadSingle();
+        }
+		
 
         public static byte[] SwitchEndian(byte[] x)
         {

Modified: activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/OpenWire/OpenWireBinaryReader.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/OpenWire/OpenWireBinaryReader.cs?view=diff&rev=512252&r1=512251&r2=512252
==============================================================================
--- activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/OpenWire/OpenWireBinaryReader.cs
(original)
+++ activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/OpenWire/OpenWireBinaryReader.cs
Tue Feb 27 05:43:49 2007
@@ -218,18 +218,23 @@
                 return null;
             }
         }
+
 		
-		private static Exception CreateDataFormatException()
+        public override float ReadSingle()
         {
-            // TODO: implement a better exception
-            return new IOException("Data format error!");
+            return EndianSupport.SwitchEndian(base.ReadSingle());
         }
-
+		
         public override double ReadDouble()
         {
             return EndianSupport.SwitchEndian(base.ReadDouble());
         }
-
+		
+		protected static Exception CreateDataFormatException()
+        {
+            // TODO: implement a better exception
+            return new IOException("Data format error!");
+        }
 	}
 }
 

Modified: activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/OpenWire/OpenWireBinaryWriter.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/OpenWire/OpenWireBinaryWriter.cs?view=diff&rev=512252&r1=512251&r2=512252
==============================================================================
--- activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/OpenWire/OpenWireBinaryWriter.cs
(original)
+++ activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/OpenWire/OpenWireBinaryWriter.cs
Tue Feb 27 05:43:49 2007
@@ -194,11 +194,20 @@
         /// Method Write
         /// </summary>
         /// <param name="value">A  double</param>
+        public override void Write(float value)
+        {
+            base.Write(EndianSupport.SwitchEndian(value));
+        }
+		
+        /// <summary>
+        /// Method Write
+        /// </summary>
+        /// <param name="value">A  double</param>
         public override void Write(double value)
         {
             base.Write(EndianSupport.SwitchEndian(value));
         }
 		
-    }	
+    }
 }
 



Mime
View raw message