From 7808136ebc973a428fd488a0a18f259eea0e378f Mon Sep 17 00:00:00 2001 From: James Ahlborn Date: Thu, 21 Sep 2006 13:37:15 +0000 Subject: [PATCH] make byte[] printable when dumping table git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@118 f203690c-595d-4dc9-a70b-905162fa7fd2 --- .../healthmarketscience/jackcess/DatabaseTest.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java b/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java index a383b01..541f321 100644 --- a/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java +++ b/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java @@ -7,6 +7,7 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintWriter; import java.math.BigDecimal; +import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; @@ -628,7 +629,17 @@ public class DatabaseTest extends TestCase { colNames.add(col.getName()); } writer.println("COLUMNS: " + colNames); - for(Object row : table) { + for(Map row : table) { + + // make byte[] printable + for(Map.Entry entry : row.entrySet()) { + Object v = entry.getValue(); + if(v instanceof byte[]) { + byte[] bv = (byte[])v; + entry.setValue(ByteUtil.toHexString(ByteBuffer.wrap(bv), bv.length)); + } + } + writer.println(row); } } -- 2.39.5