added hex dump->byte[] conversion

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@13530 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2008-12-12 17:41:03 +00:00
1 parent 6046506390
commit 36450deca8
2 files changed
+8 -6

No files matched your search

+7
View File
@@ -446,6 +446,13 @@ public class Util {
return toHexString(bytes,0,bytes.length);
}
public static byte[] fromHexString(String data) {
byte[] r = new byte[data.length() / 2];
for (int i = 0; i < data.length(); i += 2)
r[i / 2] = (byte) Integer.parseInt(data.substring(i, i + 2), 16);
return r;
}
/**
* Returns a human readable text of the time duration.
* This version should be used for representing a duration of some activity (like build)