diff options
author | James Ahlborn <jtahlborn@yahoo.com> | 2014-10-13 00:23:13 +0000 |
---|---|---|
committer | James Ahlborn <jtahlborn@yahoo.com> | 2014-10-13 00:23:13 +0000 |
commit | f8ba282d71706527ae6c2b787d2abc407276475f (patch) | |
tree | 59d9bace2e4075e40b2699605bb816cb044603ab /src | |
parent | ec37e5c5731303188ef60f3aef064a51bb585747 (diff) | |
download | jackcess-f8ba282d71706527ae6c2b787d2abc407276475f.tar.gz jackcess-f8ba282d71706527ae6c2b787d2abc407276475f.zip |
more unit test perf tweaks
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@890 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/healthmarketscience/jackcess/impl/ByteUtil.java | 7 | ||||
-rw-r--r-- | src/test/java/com/healthmarketscience/jackcess/impl/IndexCodesTest.java | 3 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/ByteUtil.java b/src/main/java/com/healthmarketscience/jackcess/impl/ByteUtil.java index 67f0724..5736bb3 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/ByteUtil.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/ByteUtil.java @@ -450,7 +450,12 @@ public final class ByteUtil { public static String toHexString(ByteBuffer buffer, int offset, int size, boolean formatted) { - StringBuilder rtn = new StringBuilder(); + int bufLen = size * 2; + if(formatted) { + bufLen += size + + (7 * ((size + NUM_BYTES_PER_LINE - 1) / NUM_BYTES_PER_LINE)); + } + StringBuilder rtn = new StringBuilder(bufLen); int position = buffer.position(); buffer.position(offset); size = Math.min(size, buffer.remaining()); diff --git a/src/test/java/com/healthmarketscience/jackcess/impl/IndexCodesTest.java b/src/test/java/com/healthmarketscience/jackcess/impl/IndexCodesTest.java index ddee491..973484c 100644 --- a/src/test/java/com/healthmarketscience/jackcess/impl/IndexCodesTest.java +++ b/src/test/java/com/healthmarketscience/jackcess/impl/IndexCodesTest.java @@ -792,8 +792,7 @@ public class IndexCodesTest extends TestCase { byte[] entryBytes = (byte[])ebField.get(entry); return ByteUtil.toHexString(ByteBuffer.wrap(entryBytes), - entryBytes.length) - .trim().replaceAll("\\p{Space}+", " "); + 0, entryBytes.length, false); } } |