From: James Ahlborn Date: Wed, 6 Apr 2011 02:17:24 +0000 (+0000) Subject: add convenience method for debugging X-Git-Tag: jackcess-1.2.4~9 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=84f7c316af6b1829a56b689b6babc3b6bd98d76d;p=jackcess.git add convenience method for debugging git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@548 f203690c-595d-4dc9-a70b-905162fa7fd2 --- diff --git a/src/java/com/healthmarketscience/jackcess/ByteUtil.java b/src/java/com/healthmarketscience/jackcess/ByteUtil.java index 6fe9d73..c15fc7a 100644 --- a/src/java/com/healthmarketscience/jackcess/ByteUtil.java +++ b/src/java/com/healthmarketscience/jackcess/ByteUtil.java @@ -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.