Input:
00000000: 01 00 09 00 00 03 36 00 00 00 02 00 0C 00 00 00 …...6......... 00000010: 00 00 08 00 00 00 FA 02 04 00 00 00 00 00 00 00 ......ú......... 00000020: FF 00 04 00 00 00 2D 01 00 00 07 00 00 00 FC 02 ÿ.....-.......ü. 00000030: 02 00 00 FF 00 FF 04 00 04 00 00 00 2C 01 01 00 ...ÿ.ÿ......,... 00000040: 07 00 00 00 1B 04 46 00 96 00 00 00 00 00 0C 00 ......F.–....... 00000050: 00 00 21 05 0C 00 48 65 6C 6C 6F 20 50 65 6F 70 ..!...Hello Peop 00000060: 6C 65 0A 00 0A 00 03 00 00 00 00 00
Output is the corresponding binary .wmf
file.
hexconvert.java
import java.io.*; public class hexconvert { public static void main(String [] args) { String filename = "hex1.txt"; String fout = "hex1.wmf"; if (args.length>0) filename = args[0]; String [] tokens; int n = 0; try { BufferedReader in = new BufferedReader(new FileReader(filename)); BufferedWriter out = new BufferedWriter(new FileWriter(fout)); while(in.ready()){ tokens = in.readLine().split("[\\s = ,]+"); int maxv = tokens.length - 1; if (maxv>16) maxv=16; for (n=0; n<maxv; n++) { int v = (int) Long.parseLong(tokens[n+1], 16); //System.out.format("tok %s result %x\n",tokens[n+1],v); out.write(v); } } in.close(); out.close(); } catch(Exception e) { System.err.println(e); } } }
Maintained by John Loomis, updated Mon Mar 27 12:12:30 2017