Beispiel #1
0
  public static void testDecode(String input, String encoding) throws XcodeException {
    byte[] inputarray = null;
    String output = null;
    String variant = null;

    if (input == null) {
      Debug.pass("");
      return;
    }
    input = input.trim();

    if (input.length() == 0 || input.charAt(0) == '#') {
      Debug.pass(input);
      return;
    }

    try {
      inputarray = Hex.decodeBytes(input);
      output = Native.decode(inputarray, encoding);
    } catch (XcodeException x) {
      Debug.fail(input + "	ERROR:" + x.getCode() + "	" + x.getMessage());
      return;
    }
    System.out.println(Hex.encode(output.toCharArray()));
  }
Beispiel #2
0
  public static void testDecode(String input, String[] encodings) throws XcodeException {
    byte[] inputarray = null;
    HashMap output = null;
    String variant = null;

    if (input == null) {
      Debug.pass("");
      return;
    }
    input = input.trim();

    if (input.length() == 0 || input.charAt(0) == '#') {
      Debug.pass(input);
      return;
    }

    try {
      inputarray = Hex.decodeBytes(input);
      if (encodings == null || encodings.length == 0) {
        output = Native.decode(inputarray);
      } else {
        output = Native.decode(inputarray, encodings);
      }
    } catch (XcodeException x) {
      Debug.fail(input + "	ERROR:" + x.getCode() + "	" + x.getMessage());
      return;
    }

    System.out.println(input);
    Iterator i = output.keySet().iterator();
    String encoding = null;
    while (i.hasNext()) {
      encoding = (String) i.next();
      variant = (String) output.get(encoding);
      System.out.println("	" + encoding + "	" + Hex.encode(variant.toCharArray()));
    }
    System.out.println(output.size());
  }