You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2004/09/01 07:14:24 UTC
svn commit: rev 37305 - incubator/directory/snickers/trunk/ber-codec/src/java/org/apache/snickers/ber
Author: akarasulu
Date: Tue Aug 31 22:14:23 2004
New Revision: 37305
Modified:
incubator/directory/snickers/trunk/ber-codec/src/java/org/apache/snickers/ber/TupleTreeAnalyzer.java
Log:
added extra method to dump direct buffer as hex
Modified: incubator/directory/snickers/trunk/ber-codec/src/java/org/apache/snickers/ber/TupleTreeAnalyzer.java
==============================================================================
--- incubator/directory/snickers/trunk/ber-codec/src/java/org/apache/snickers/ber/TupleTreeAnalyzer.java (original)
+++ incubator/directory/snickers/trunk/ber-codec/src/java/org/apache/snickers/ber/TupleTreeAnalyzer.java Tue Aug 31 22:14:23 2004
@@ -396,6 +396,22 @@
}
+ /**
+ * Gets a hexDump of a direct buffer without affecting the buffer. Used
+ * for primitive analysis especially when direct memory buffers are used
+ * which cannot be easily inspected within debuggers.
+ *
+ * @param buf the buffer to generate a hex dump for
+ * @return a hex string representing the buffer
+ */
+ public static String getHexDump( ByteBuffer buf )
+ {
+ byte[] bites = new byte[buf.remaining()];
+ buf.duplicate().get( bites );
+ return new String( Hex.encodeHex( bites ) );
+ }
+
+
public static void analyze( byte[] bites ) throws DecoderException
{
TupleTreeAnalyzer analyzer = new TupleTreeAnalyzer( bites );