aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2011-04-06 02:17:24 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2011-04-06 02:17:24 +0000
commit84f7c316af6b1829a56b689b6babc3b6bd98d76d (patch)
tree8355ec38bd9713f2631994de0fa3331b61056e28
parent748e2e82128b938b95ac74a30ae1315fac167bf8 (diff)
downloadjackcess-84f7c316af6b1829a56b689b6babc3b6bd98d76d.tar.gz
jackcess-84f7c316af6b1829a56b689b6babc3b6bd98d76d.zip
add convenience method for debugging
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@548 f203690c-595d-4dc9-a70b-905162fa7fd2
-rw-r--r--src/java/com/healthmarketscience/jackcess/ByteUtil.java12
1 files changed, 12 insertions, 0 deletions
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
@@ -441,6 +441,18 @@ public final class ByteUtil {
}
/**
+ * 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.
*/