From 84f7c316af6b1829a56b689b6babc3b6bd98d76d Mon Sep 17 00:00:00 2001 From: James Ahlborn Date: Wed, 6 Apr 2011 02:17:24 +0000 Subject: [PATCH] add convenience method for debugging git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@548 f203690c-595d-4dc9-a70b-905162fa7fd2 --- .../com/healthmarketscience/jackcess/ByteUtil.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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. -- 2.39.5