public void run() {
        String inLine = null;
        for (;;) {
            try {
                while ((inLine = in.readLine()) != null) {
                    String md5;
                    String url;
                    int index = inLine.indexOf('\t');
                    md5 = inLine.substring(0, index);
                    url = inLine.substring(index + 1, inLine.length());
                    InputSource is;

                    PrudentHttpEntityResolver resolver;
                    resolver = new PrudentHttpEntityResolver(1024*1024, false, null);
                    resolver.setAcceptAllKnownXmlTypes(false);
                    resolver.setAllowGenericXml(false);
                    resolver.setAllowRnc(false);
                    resolver.setAllowXhtml(false);
                    resolver.setAllowHtml(true);
                    
                    try {
                        is = resolver.resolveEntity(null, url);
                    } catch (Exception e) {
                        continue;
                    }
                    String charset = is.getEncoding();
                    if (charset == null || charset.indexOf('\t') != -1) {
                        charset = "null";
                    }
                    File top = new File(rootDir, md5.substring(0, 2));
                    synchronized (rootDir) {
                        top.mkdir();
                    }
                    File second = new File(top, md5.substring(2, 4));
                    synchronized (rootDir) {
                        second.mkdir();
                    }
                    File outFile = new File(second, md5 + ".gz");
                    InputStream inStream = is.getByteStream();
                    try {
                        OutputStream outStream = new GZIPOutputStream(
                                new FileOutputStream(outFile));
                        IO.copy(inStream, outStream);
                        outStream.flush();
                        outStream.close();
                    } catch (Exception e) {
                        outFile.delete();
                        continue;
                    } finally {
                        inStream.close();
                    }
                    out.println(md5 + '\t' + url + '\t' + charset);
                }
                return;
            } catch (Exception e) {

            }
        }
    }
@param in
@param out
@param rootDir
@param resolver
resources/examples/research-src/nu/validator/dmozdl/Downloader.java