commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1378947 - /commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java
Date Thu, 30 Aug 2012 14:16:13 GMT
Author: ggregory
Date: Thu Aug 30 14:16:13 2012
New Revision: 1378947

URL: http://svn.apache.org/viewvc?rev=1378947&view=rev
Log:
Add toString() method useful for debugging.

Modified:
    commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java

Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java?rev=1378947&r1=1378946&r2=1378947&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java
(original)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java
Thu Aug 30 14:16:13 2012
@@ -89,6 +89,18 @@ public abstract class BaseNCodec impleme
 
         Context() {
         }
+
+        /**
+         * Returns a String useful for debugging (especially within a debugger.)
+         * 
+         * @return a String useful for debugging.
+         */
+        public String toString() {
+            return String
+                    .format("%s[buffer=%s, currentLinePos=%s, eof=%s, ibitWorkArea=%s, lbitWorkArea=%s,
modulus=%s, pos=%s, readPos=%s]",
+                            this.getClass().getSimpleName(), buffer, currentLinePos, eof,
ibitWorkArea, lbitWorkArea,
+                            modulus, pos, readPos);
+        }
     }
 
     /**



Mime
View raw message