Example #1
0
 @Test
 public void testEscapeStrings() throws Exception {
   pass = true;
   assert (esinputs.length == esoutputs.length);
   for (int i = 0; i < esinputs.length && pass; i++) {
     String result = EscapeStrings.escapeURL(esinputs[i]);
     System.err.printf("input= |%s|\n", esinputs[i]);
     System.err.printf("result=|%s|\n", result);
     System.err.printf("output=|%s|\n", esoutputs[i]);
     if (!result.equals(esoutputs[i])) pass = false;
     System.out.printf("input=%s output=%s pass=%s\n", esinputs[i], result, pass);
   }
   Assert.assertTrue("TestMisc.testEscapeStrings", pass);
 }
Example #2
0
  public static void showCache(PrintStream pw) {
    pw.println("Cache files");
    pw.println("Size   LastModified       Filename");
    File dir = new File(root);
    for (File file : dir.listFiles()) {
      String org = null;
      org = EscapeStrings.urlDecode(file.getName());
      /*try {
        org = URLDecoder.decode(file.getName(), "UTF8");
      } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
      }*/

      pw.println(" " + file.length() + " " + new Date(file.lastModified()) + " " + org);
    }
  }