]> source.dussan.org Git - poi.git/commitdiff
add toString() to SprmBuffer
authorSergey Vladimirov <sergey@apache.org>
Tue, 12 Jul 2011 00:38:39 +0000 (00:38 +0000)
committerSergey Vladimirov <sergey@apache.org>
Tue, 12 Jul 2011 00:38:39 +0000 (00:38 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1145407 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmBuffer.java

index 9ff32d010f097fa22dabf6e233406d99aa0476ec..353566b69d7beb5ba7616145cf195b9ab1562b9d 100644 (file)
@@ -220,4 +220,26 @@ public final class SprmBuffer implements Cloneable
         }
         addSprm(opcode, operand);
       }
+
+    @Override
+    public String toString()
+    {
+        StringBuilder stringBuilder = new StringBuilder();
+        stringBuilder.append( "Sprms (" );
+        stringBuilder.append( _buf.length );
+        stringBuilder.append( " byte(s)): " );
+        for ( SprmIterator iterator = iterator(); iterator.hasNext(); )
+        {
+            try
+            {
+                stringBuilder.append( iterator.next() );
+            }
+            catch ( Exception exc )
+            {
+                stringBuilder.append( "error" );
+            }
+            stringBuilder.append( "; " );
+        }
+        return stringBuilder.toString();
+    }
 }