public static void main(String[] args) throws IOException,
            NoSuchAlgorithmException {
        SortedMap<String, String> theMap = new TreeMap<String, String>();
        MessageDigest md = MessageDigest.getInstance("MD5");
        IRIFactory fac = new IRIFactory();
        BufferedReader in = new BufferedReader(new InputStreamReader(
                new FileInputStream(args[0]), "utf-8"));
        String line;
        while ((line = in.readLine()) != null) {
            byte[] md5 = md.digest(line.getBytes("utf-8"));
            String md5str = toHexString(md5);
            IRI iri = fac.create("http://upload.wikimedia.org/wikipedia/commons/"
                    + md5str.substring(0, 1)
                    + '/'
                    + md5str.substring(0, 2)
                    + '/' + line);
            String uri = iri.toASCIIString();
            theMap.put(md5str, uri);
        }
        Writer out = new OutputStreamWriter(new FileOutputStream(args[1]),
                "utf-8");
        for (Map.Entry<String, String> entry : theMap.entrySet()) {
            out.write(entry.getKey());
            out.write('\t');
            out.write(entry.getValue());
            out.write('\n');
        }
        out.flush();
        out.close();

        File dir = new File(args[2]);

        int total = theMap.size();
        int count = 0;
        for (Map.Entry<String, String> entry : theMap.entrySet()) {
            File target = new File(dir, entry.getKey() + ".svg");
            retrieve(entry.getValue(), target);
            count++;
            System.out.println(((double) count) / ((double) total));
        }

    }
@param args
@throws IOException
@throws NoSuchAlgorithmException
resources/examples/research-src/nu/validator/svgresearch/SvgDownloader.java