251 in.close();
252 markJarFile(out); // add PACK200 comment
253 }
254 static void copyJarFile(JarFile in, JarOutputStream out) throws IOException {
255 byte[] buffer = new byte[1 << 14];
256 for (Enumeration e = in.entries(); e.hasMoreElements(); ) {
257 JarEntry je = (JarEntry) e.nextElement();
258 out.putNextEntry(je);
259 InputStream ein = in.getInputStream(je);
260 for (int nr; 0 < (nr = ein.read(buffer)); ) {
261 out.write(buffer, 0, nr);
262 }
263 }
264 in.close();
265 markJarFile(out); // add PACK200 comment
266 }
267 static void copyJarFile(JarInputStream in, OutputStream out) throws IOException {
268 // 4947205 : Peformance is slow when using pack-effort=0
269 out = new BufferedOutputStream(out);
270 out = new NonCloser(out); // protect from JarOutputStream.close()
271 JarOutputStream jout = new JarOutputStream(out);
272 copyJarFile(in, jout);
273 jout.close();
274 }
275 static void copyJarFile(JarFile in, OutputStream out) throws IOException {
276
277 // 4947205 : Peformance is slow when using pack-effort=0
278 out = new BufferedOutputStream(out);
279 out = new NonCloser(out); // protect from JarOutputStream.close()
280 JarOutputStream jout = new JarOutputStream(out);
281 copyJarFile(in, jout);
282 jout.close();
283 }
284 // Wrapper to prevent closing of client-supplied stream.
285 static private
286 class NonCloser extends FilterOutputStream {
287 NonCloser(OutputStream out) { super(out); }
288 public void close() throws IOException { flush(); }
289 }
290 static String getJarEntryName(String name) {
291 if (name == null) return null;
292 return name.replace(File.separatorChar, '/');
293 }
294
295 static String zeString(ZipEntry ze) {
296 int store = (ze.getCompressedSize() > 0) ?
297 (int)( (1.0 - ((double)ze.getCompressedSize()/(double)ze.getSize()))*100 )
298 : 0 ;
299 // Follow unzip -lv output
300 return ze.getSize() + "\t" + ze.getMethod()
301 + "\t" + ze.getCompressedSize() + "\t"
302 + store + "%\t"
|
251 in.close();
252 markJarFile(out); // add PACK200 comment
253 }
254 static void copyJarFile(JarFile in, JarOutputStream out) throws IOException {
255 byte[] buffer = new byte[1 << 14];
256 for (Enumeration e = in.entries(); e.hasMoreElements(); ) {
257 JarEntry je = (JarEntry) e.nextElement();
258 out.putNextEntry(je);
259 InputStream ein = in.getInputStream(je);
260 for (int nr; 0 < (nr = ein.read(buffer)); ) {
261 out.write(buffer, 0, nr);
262 }
263 }
264 in.close();
265 markJarFile(out); // add PACK200 comment
266 }
267 static void copyJarFile(JarInputStream in, OutputStream out) throws IOException {
268 // 4947205 : Peformance is slow when using pack-effort=0
269 out = new BufferedOutputStream(out);
270 out = new NonCloser(out); // protect from JarOutputStream.close()
271 try (JarOutputStream jout = new JarOutputStream(out)) {
272 copyJarFile(in, jout);
273 }
274 }
275 static void copyJarFile(JarFile in, OutputStream out) throws IOException {
276
277 // 4947205 : Peformance is slow when using pack-effort=0
278 out = new BufferedOutputStream(out);
279 out = new NonCloser(out); // protect from JarOutputStream.close()
280 try (JarOutputStream jout = new JarOutputStream(out)) {
281 copyJarFile(in, jout);
282 }
283 }
284 // Wrapper to prevent closing of client-supplied stream.
285 static private
286 class NonCloser extends FilterOutputStream {
287 NonCloser(OutputStream out) { super(out); }
288 public void close() throws IOException { flush(); }
289 }
290 static String getJarEntryName(String name) {
291 if (name == null) return null;
292 return name.replace(File.separatorChar, '/');
293 }
294
295 static String zeString(ZipEntry ze) {
296 int store = (ze.getCompressedSize() > 0) ?
297 (int)( (1.0 - ((double)ze.getCompressedSize()/(double)ze.getSize()))*100 )
298 : 0 ;
299 // Follow unzip -lv output
300 return ze.getSize() + "\t" + ze.getMethod()
301 + "\t" + ze.getCompressedSize() + "\t"
302 + store + "%\t"
|