add toString() to SprmBuffer

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1145407 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sergey Vladimirov 2011-07-12 00:38:39 +00:00
parent d7557a802b
commit 6d3bd4e5b4

View 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();
}
}