activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r452752 - /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/MarshallingSupport.java
Date Wed, 04 Oct 2006 06:13:13 GMT
Author: jstrachan
Date: Tue Oct  3 23:13:12 2006
New Revision: 452752

URL: http://svn.apache.org/viewvc?view=rev&rev=452752
Log:
minor refactor to create marshalString helper method

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/MarshallingSupport.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/MarshallingSupport.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/MarshallingSupport.java?view=diff&rev=452752&r1=452751&r2=452752
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/MarshallingSupport.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/MarshallingSupport.java
Tue Oct  3 23:13:12 2006
@@ -145,17 +145,7 @@
             out.writeInt(((byte[])value).length);
             out.write(((byte[])value));
         } else if( value.getClass() == String.class ) {
-            String s = (String)value;
-            
-            // If it's too big, out.writeUTF may not able able to write it out.
-            if( s.length() < Short.MAX_VALUE/4 ) {
-                out.writeByte(STRING_TYPE);
-                out.writeUTF((String)value);
-            } else {
-                out.writeByte(BIG_STRING_TYPE);
-                writeUTF8(out, s);
-            }
-            
+            marshalString(out, (String)value);
         } else if( value instanceof Map) {
             out.writeByte(MAP_TYPE);
             marshalPrimitiveMap((Map) value, out);
@@ -214,6 +204,18 @@
         }
         return value;
     }
+
+    public static void marshalString(DataOutputStream out, String s) throws IOException {
+        // If it's too big, out.writeUTF may not able able to write it out.
+        if( s.length() < Short.MAX_VALUE/4 ) {
+            out.writeByte(STRING_TYPE);
+            out.writeUTF(s);
+        } else {
+            out.writeByte(BIG_STRING_TYPE);
+            writeUTF8(out, s);
+        }
+    }
+
 
     static public void writeUTF8(DataOutput dataOut, String text) throws IOException {
         if (text != null) {



Mime
View raw message