]> source.dussan.org Git - jackcess.git/commitdiff
add convenience method for debugging
authorJames Ahlborn <jtahlborn@yahoo.com>
Wed, 6 Apr 2011 02:17:24 +0000 (02:17 +0000)
committerJames Ahlborn <jtahlborn@yahoo.com>
Wed, 6 Apr 2011 02:17:24 +0000 (02:17 +0000)
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@548 f203690c-595d-4dc9-a70b-905162fa7fd2

src/java/com/healthmarketscience/jackcess/ByteUtil.java

index 6fe9d73b5b40ca57aa622c8e924e483aade65694..c15fc7a792cb35bca7ded7c163a5439d6dff54ef 100644 (file)
@@ -440,6 +440,18 @@ public final class ByteUtil {
     return rtn.toString();
   }
 
+  /**
+   * Convert the given number of bytes from the given database page to a
+   * hexidecimal string for display.
+   */
+  public static String toHexString(Database db, int pageNumber, int size)
+    throws IOException
+  {
+    ByteBuffer buffer = db.getPageChannel().createPageBuffer();
+    db.getPageChannel().readPage(buffer, pageNumber);
+    return toHexString(buffer, size);
+  }
+
   /**
    * Writes a sequence of hexidecimal values into the given buffer, where
    * every two characters represent one byte value.