You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2009/06/25 16:42:25 UTC

svn commit: r788366 - /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Stomp/StompFrameStream.cs

Author: tabish
Date: Thu Jun 25 14:42:25 2009
New Revision: 788366

URL: http://svn.apache.org/viewvc?rev=788366&view=rev
Log:
Fix for: http://issues.apache.org/activemq/browse/AMQNET-167

Modified:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Stomp/StompFrameStream.cs

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Stomp/StompFrameStream.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Stomp/StompFrameStream.cs?rev=788366&r1=788365&r2=788366&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Stomp/StompFrameStream.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Stomp/StompFrameStream.cs Thu Jun 25 14:42:25 2009
@@ -31,95 +31,95 @@
     /// </summary>
     public class StompFrameStream
     {
-		public const String NEWLINE = "\n";
-		public const String SEPARATOR = ":";
-		public const char NULL = (char) 0;
-		
-		private StringBuilder builder = new StringBuilder();
-		private BinaryWriter ds;
-		private byte[] content;
-		private int contentLength = -1;
-		private Encoding encoding;
-		
-		public StompFrameStream(BinaryWriter ds, Encoding encoding)
-		{
-			this.ds = ds;
-			this.encoding = encoding;
-		}
-
-		
-		public byte[] Content
-		{
-			get { return content; }
-			set { content = value; }
-		}
-		
-		public int ContentLength
-		{
-			get { return contentLength; }
-			set
-			{
-				contentLength = value;
-				WriteHeader("content-length", contentLength);
-			}
-		}
-
-		public void WriteCommand(Command command, String name)
-		{
-			WriteCommand(command, name, false);
-		}
-
-		public void WriteCommand(Command command, String name, bool ignoreErrors)
-		{
-			builder.Append(name);
-			builder.Append(NEWLINE);
-			if(command.ResponseRequired)
-			{
-				if(ignoreErrors)
-				{
-					WriteHeader("receipt", "ignore:" + command.CommandId);
-				}
-				else
-				{
-					WriteHeader("receipt", command.CommandId);
-				}
-			}
-		}
-		
-		public void WriteHeader(String name, Object value)
-		{
-			if (value != null)
-			{
-				builder.Append(name);
-				builder.Append(SEPARATOR);
-				builder.Append(value);
-				builder.Append(NEWLINE);
-			}
-		}
-		
-		public void WriteHeader(String name, bool value)
-		{
-			if (value)
-			{
-				builder.Append(name);
-				builder.Append(SEPARATOR);
-				builder.Append("true");
-				builder.Append(NEWLINE);
-			}
-		}
-		
-		public void Flush()
-		{
-			builder.Append(NEWLINE);
-			ds.Write(encoding.GetBytes(builder.ToString()));
-			
-			if (content != null)
-			{
-				ds.Write(content);
-			}
-
-			// Always write a terminating NULL byte to end the content frame.
-			ds.Write(NULL);
-		}
+        public const String NEWLINE = "\n";
+        public const String SEPARATOR = ":";
+        public const byte NULL = (byte) 0;
+
+        private StringBuilder builder = new StringBuilder();
+        private BinaryWriter ds;
+        private byte[] content;
+        private int contentLength = -1;
+        private Encoding encoding;
+
+        public StompFrameStream(BinaryWriter ds, Encoding encoding)
+        {
+            this.ds = ds;
+            this.encoding = encoding;
+        }
+
+
+        public byte[] Content
+        {
+            get { return content; }
+            set { content = value; }
+        }
+
+        public int ContentLength
+        {
+            get { return contentLength; }
+            set
+            {
+                contentLength = value;
+                WriteHeader("content-length", contentLength);
+            }
+        }
+
+        public void WriteCommand(Command command, String name)
+        {
+            WriteCommand(command, name, false);
+        }
+
+        public void WriteCommand(Command command, String name, bool ignoreErrors)
+        {
+            builder.Append(name);
+            builder.Append(NEWLINE);
+            if(command.ResponseRequired)
+            {
+                if(ignoreErrors)
+                {
+                    WriteHeader("receipt", "ignore:" + command.CommandId);
+                }
+                else
+                {
+                    WriteHeader("receipt", command.CommandId);
+                }
+            }
+        }
+
+        public void WriteHeader(String name, Object value)
+        {
+            if (value != null)
+            {
+                builder.Append(name);
+                builder.Append(SEPARATOR);
+                builder.Append(value);
+                builder.Append(NEWLINE);
+            }
+        }
+
+        public void WriteHeader(String name, bool value)
+        {
+            if (value)
+            {
+                builder.Append(name);
+                builder.Append(SEPARATOR);
+                builder.Append("true");
+                builder.Append(NEWLINE);
+            }
+        }
+
+        public void Flush()
+        {
+            builder.Append(NEWLINE);
+            ds.Write(encoding.GetBytes(builder.ToString()));
+
+            if (content != null)
+            {
+                ds.Write(content);
+            }
+
+            // Always write a terminating NULL byte to end the content frame.
+            ds.Write(NULL);
+        }
     }
 }