diff options
author | mcentner <mcentner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2010-06-16 11:19:41 +0000 |
---|---|---|
committer | mcentner <mcentner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2010-06-16 11:19:41 +0000 |
commit | 265b0aca555d9880361b754b6a18ce70b5be28cd (patch) | |
tree | 158387c96aa33e53beec0caab6bb938148c15587 /utils/src/main/java/at/gv/egiz | |
parent | 1615a1e0bea092641bd72351876f6aa6edba655e (diff) | |
download | mocca-265b0aca555d9880361b754b6a18ce70b5be28cd.tar.gz mocca-265b0aca555d9880361b754b6a18ce70b5be28cd.tar.bz2 mocca-265b0aca555d9880361b754b6a18ce70b5be28cd.zip |
Refactored smart card unit tests to use Spring to configure smart card emulators.
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@754 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'utils/src/main/java/at/gv/egiz')
-rw-r--r-- | utils/src/main/java/at/gv/egiz/bku/utils/HexDump.java | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/utils/src/main/java/at/gv/egiz/bku/utils/HexDump.java b/utils/src/main/java/at/gv/egiz/bku/utils/HexDump.java index 88d49bad..a1b8a00d 100644 --- a/utils/src/main/java/at/gv/egiz/bku/utils/HexDump.java +++ b/utils/src/main/java/at/gv/egiz/bku/utils/HexDump.java @@ -32,14 +32,21 @@ public class HexDump { public static void hexDump(InputStream is, Writer writer) throws IOException {
hexDump(is, writer, 16);
}
+ + public static void hexDump(InputStream is, Writer writer, int chunkSize) throws IOException { + hexDump(is, writer, chunkSize, false); + } - public static void hexDump(InputStream is, Writer writer, int chunkSize) throws IOException {
+ public static void hexDump(InputStream is, Writer writer, int chunkSize, boolean plain) throws IOException {
byte[] chunk = new byte[chunkSize];
long adr = 0;
for (int l; (l = is.read(chunk)) != -1;) {
+ + if (!plain) {
+ writer.append(String.format("[%06x]", adr)); + } - writer.append(String.format("[%06x]", adr));
for (int i = 0; i < l; i++) {
if (i % 8 == 0) {
writer.append(" ");
@@ -53,16 +60,18 @@ public class HexDump { for (int i = 0; i < (chunkSize - l); i++) {
writer.append(" ");
}
-
- for (int i = 0; i < l; i++) {
- if (i % 8 == 0) {
- writer.append(" ");
- }
- if (chunk[i] > 31 && chunk[i] < 127) {
- writer.append((char) chunk[i]);
- } else {
- writer.append(".");
- }
+ + if (!plain) {
+ for (int i = 0; i < l; i++) {
+ if (i % 8 == 0) {
+ writer.append(" ");
+ }
+ if (chunk[i] > 31 && chunk[i] < 127) {
+ writer.append((char) chunk[i]);
+ } else {
+ writer.append(".");
+ }
+ } }
writer.append("\n");
|