@@ -106,6 +106,7 @@ public class NativeHandler {
106106 public static final int MARKER_SHORT = 9 ;
107107 public static final int MARKER_DOUBLE = 10 ;
108108 public static final int MARKER_DATE = 11 ;
109+ public static final int MARKER_STRINGBUILDER = 12 ;
109110
110111 public static boolean isHandled ( Object value ) {
111112
@@ -114,6 +115,7 @@ public static boolean isHandled( Object value ) {
114115 value instanceof String ||
115116 value instanceof Character ||
116117 value instanceof StringBuffer ||
118+ value instanceof StringBuilder ||
117119 value instanceof Short ||
118120 value instanceof Long ||
119121 value instanceof Double ||
@@ -153,6 +155,9 @@ public static byte[] encode( Object value ) throws Exception {
153155 if ( value instanceof StringBuffer )
154156 return encode ( (StringBuffer )value );
155157
158+ if ( value instanceof StringBuilder )
159+ return encode ( (StringBuilder )value );
160+
156161 if ( value instanceof Short )
157162 return encode ( (Short )value );
158163
@@ -256,6 +261,15 @@ public static byte[] encode( StringBuffer value ) throws Exception {
256261
257262 }
258263
264+ public static byte [] encode ( StringBuilder value ) throws Exception {
265+
266+ byte [] b = encode ( value .toString () );
267+ b [0 ] = MARKER_STRINGBUILDER ;
268+
269+ return b ;
270+
271+ }
272+
259273 public static byte [] encode ( Short value ) throws Exception {
260274
261275 byte [] b = encode ( (int )value .shortValue () );
@@ -426,6 +440,12 @@ public static StringBuffer decodeStringBuffer( byte[] b ) throws Exception {
426440
427441 }
428442
443+ public static StringBuilder decodeStringBuilder ( byte [] b ) throws Exception {
444+
445+ return new StringBuilder ( decodeString ( b ) );
446+
447+ }
448+
429449 public static Short decodeShort ( byte [] b ) throws Exception {
430450
431451 //FIXME: this generates an extra object we don't need
0 commit comments