directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 37305 - incubator/directory/snickers/trunk/ber-codec/src/java/org/apache/snickers/ber
Date Wed, 01 Sep 2004 05:14:24 GMT
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 );

Mime
View raw message