private ArrayList processPage(InputStream in, String baseDir, URL url) throws IOException {
    BufferedReader buffIn = new BufferedReader(new InputStreamReader(in));
    String line;
    ArrayList urlList = new ArrayList();
    String fileName;
    if (url.getFile().equals("/")) fileName = "index";
    else {
      fileName = url.getFile();
    }
    fileName = baseDir + File.separator + niceifyLink(fileName);
    PrintWriter out = new PrintWriter(new BufferedOutputStream(new FileOutputStream(fileName)));

    while ((line = buffIn.readLine()) != null) {
      out.print(checkForLinks(line, urlList));
    }

    if (out != null) {
      out.flush();
      out.close();
    }
    return urlList;
  }
 private void writeDeadFile(String fileName) {
   try {
     PrintWriter out = new PrintWriter(new BufferedOutputStream(new FileOutputStream(fileName)));
     out.println("<TITLE>Error</TITLE>");
     out.println("<BODY BGCOLOR=\"white\">");
     out.println("<h1>Operation not allowed</h1>");
     out.println("<hr>");
     out.println("<P>This operation only works for live Qat instances");
     out.println("<hr>");
     out.println("<A HREF=\"./index.html\">Report Index</A><BR>");
     out.println("</BODY>");
     out.println("</HTML>");
     out.flush();
     out.close();
   } catch (IOException e) {
     System.out.println("Error writing page:" + fileName + " " + e.toString());
   }
 }