Make the API of all encoding classes similar

This commit is contained in:
Alexander Bakker 2018-03-19 18:33:38 +01:00
parent 9c433f96cf
commit 0ad39ab673
5 changed files with 12 additions and 12 deletions

View file

@ -15,7 +15,7 @@ public class Hex {
private static final char[] hexCode = "0123456789abcdef".toCharArray();
public static byte[] toBytes(String s) throws HexException {
public static byte[] decode(String s) throws HexException {
final int len = s.length();
if (len % 2 != 0)
@ -35,7 +35,7 @@ public class Hex {
return out;
}
public static String toString(byte[] data) {
public static String encode(byte[] data) {
StringBuilder r = new StringBuilder(data.length * 2);
for (byte b : data) {
r.append(hexCode[(b >> 4) & 0xF]);