Jar and Zip Enhancements

This page summarizes enhancements to the jar and zip support provided in JDK 6.

API changes

Two new compressed streams have been added:

  • java.util.zip.DeflaterInputStream: Data read from this stream is compressed.
  • java.util.zip.InflaterOutputStream: Data written to this stream is decompressed.
For example, these can be useful if a client wants to send compressed data over a network. The data can be compressed into packets with DeflaterInputStream, and those packets written over the network connection. The receiving end then reads the compressed packets from the network connection, and decompresses them by writing to an InflaterOutputStream.

Implementation changes

On all platforms, zip files can contain more than 64k entries.

On Windows, some limitations have been removed:

  • File names longer than 256 characters are now supported.
  • The limitation of just over 2,000 simultaneously open zip files has been removed.

Changes to the jar command

There are two changes to the behavior of the jar command:

  • The timestamps of extracted files are those listed in the archive, instead of the time of extraction.
  • When creating a jar, it is possible to specify the entry point for stand-alone applications bundled into an executable jar file. The 'e' option specifies the application entry point by creating or overriding the Main-Class attribute value in the jar file's manifest.

Oracle and/or its affiliates Copyright © 1993, 2015, Oracle and/or its affiliates. All rights reserved.

微信小程序

微信扫一扫体验

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部