1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
   | s = null;
    command = "jar tf " + xrootdDir + "/xrootd.jar";// | egrep '.jpg|.png|.gif'";// | awk '{print \"jar xvf\" $1}'";
    rt = Runtime.getRuntime();
    proc = rt.exec(command);
    rc = proc.waitFor(); // the application is waiting for the end of this process
    stdout = new BufferedReader(new InputStreamReader(proc.getInputStream()));
    stderr = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
    fichImages.clear();
    // while the command gives some results
    while((s = stdout.readLine()) != null)
    {
     // separation between the name of the file and the extension
     int extension = s.indexOf(".");
     if(extension != -1)
     {
      // we want only the png, gif and jpg files
      if((s.substring(extension, s.length())).equals(".png") || (s.substring(extension, s.length())).equals(".jpg") || (s.substring(extension, s.length())).equals(".gif"))
      {
       fichImages.add(s);
      }
     }
         } | 
Partager