jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Driver.java
changeset 32649 2ee9017c7597
parent 25859 3317bb8137f4
equal deleted inserted replaced
32648:1fa861caf840 32649:2ee9017c7597
   374             if (!tmpfile.equals(""))
   374             if (!tmpfile.equals(""))
   375                 new File(tmpfile).delete();
   375                 new File(tmpfile).delete();
   376         }
   376         }
   377     }
   377     }
   378 
   378 
   379     static private
   379     private static
   380     File createTempFile(String basefile, String suffix) throws IOException {
   380     File createTempFile(String basefile, String suffix) throws IOException {
   381         File base = new File(basefile);
   381         File base = new File(basefile);
   382         String prefix = base.getName();
   382         String prefix = base.getName();
   383         if (prefix.length() < 3)  prefix += "tmp";
   383         if (prefix.length() < 3)  prefix += "tmp";
   384 
   384 
   391                 : Files.createTempFile(where.toPath(), prefix, suffix);
   391                 : Files.createTempFile(where.toPath(), prefix, suffix);
   392 
   392 
   393         return tmpfile.toFile();
   393         return tmpfile.toFile();
   394     }
   394     }
   395 
   395 
   396     static private
   396     private static
   397     void printUsage(boolean doPack, boolean full, PrintStream out) {
   397     void printUsage(boolean doPack, boolean full, PrintStream out) {
   398         String prog = doPack ? "pack200" : "unpack200";
   398         String prog = doPack ? "pack200" : "unpack200";
   399         String[] packUsage = (String[])RESOURCE.getObject(DriverResource.PACK_HELP);
   399         String[] packUsage = (String[])RESOURCE.getObject(DriverResource.PACK_HELP);
   400         String[] unpackUsage = (String[])RESOURCE.getObject(DriverResource.UNPACK_HELP);
   400         String[] unpackUsage = (String[])RESOURCE.getObject(DriverResource.UNPACK_HELP);
   401         String[] usage = doPack? packUsage: unpackUsage;
   401         String[] usage = doPack? packUsage: unpackUsage;
   406                 break;
   406                 break;
   407             }
   407             }
   408         }
   408         }
   409     }
   409     }
   410 
   410 
   411     static private
   411     private static
   412         String getZipComment(String jarfile) throws IOException {
   412         String getZipComment(String jarfile) throws IOException {
   413         byte[] tail = new byte[1000];
   413         byte[] tail = new byte[1000];
   414         long filelen = new File(jarfile).length();
   414         long filelen = new File(jarfile).length();
   415         if (filelen <= 0)  return "";
   415         if (filelen <= 0)  return "";
   416         long skiplen = Math.max(0, filelen - tail.length);
   416         long skiplen = Math.max(0, filelen - tail.length);