pack200.html

来自「j2se5-api-zh,java文档的中文版本」· HTML 代码 · 共 342 行 · 第 1/2 页

HTML
342
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc (build 1.5.0_03) on Wed Nov 02 09:52:06 CST 2005 --><META http-equiv="Content-Type" content="text/html; charset=gb2312"><TITLE>Pack200 (Java 2 Platform SE 5.0)</TITLE><META NAME="keywords" CONTENT="java.util.jar.Pack200 class"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){    parent.document.title="Pack200 (Java 2 Platform SE 5.0)";}</SCRIPT><NOSCRIPT></NOSCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= START OF TOP NAVBAR ======= --><A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="跳过导航链接"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">  <TR ALIGN="center" VALIGN="top">  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>概述</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>软件包</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>类</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Pack200.html"><FONT CLASS="NavBarFont1"><B>使用</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>树</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>已过时</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>索引</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>帮助</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup>&nbsp;2&nbsp;Platform<br>Standard&nbsp;Ed. 5.0</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="Manifest.html" title="java.util.jar 中的类"><B>上一个类</B></A>&nbsp;&nbsp;<A HREF="Pack200.Packer.html" title="java.util.jar 中的接口"><B>下一个类</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../../index.html@java_2Futil_2Fjar_2FPack200.html" target="_top"><B>框架</B></A>  &nbsp;&nbsp;<A HREF="Pack200.html" target="_top"><B>无框架</B></A>  &nbsp;&nbsp;<SCRIPT type="text/javascript">  <!--  if(window==top) {    document.writeln('<A HREF="../../../allclasses-noframe.html"><B>所有类</B></A>');  }  //--></SCRIPT><NOSCRIPT>  <A HREF="../../../allclasses-noframe.html"><B>所有类</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  摘要:&nbsp;<A HREF="#nested_class_summary">嵌套</A>&nbsp;|&nbsp;字段&nbsp;|&nbsp;构造方法&nbsp;|&nbsp;<A HREF="#method_summary">方法</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">详细信息:&nbsp;字段&nbsp;|&nbsp;构造方法&nbsp;|&nbsp;<A HREF="#method_detail">方法</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">java.util.jar</FONT><BR>类 Pack200</H2><PRE><A HREF="../../lang/Object.html" title="java.lang 中的类">java.lang.Object</A>  <IMG SRC="../../../resources/inherit.gif" ALT="继承者 "><B>java.util.jar.Pack200</B></PRE><HR><DL><DT><PRE>public abstract class <B>Pack200</B><DT>extends <A HREF="../../lang/Object.html" title="java.lang 中的类">Object</A></DL></PRE><P>以 Pack200 格式在 JAR 文件和打包的流之间进行转换。请参阅以下网址的《Network Trasfer Format JSR 200 Specification》:http://jcp.org/aboutJava/communityprocess/review/jsr200/index.html。 <p>通常,应用程序开发人员使用打包器引擎在网站上部署或宿主 JAR 文件。部署应用程序则使用解包器引擎把字节流转换回 JAR 格式。 <p>下面是使用打包器和解包器的一个示例:<p> <blockquote><pre>    import java.util.jar.Pack200;    import java.util.jar.Pack200.*;    ...    // Create the Packer object    Packer packer = Pack200.newPacker();    // Initialize the state by setting the desired properties    Map p = packer.properties();    // take more time choosing codings for better compression    p.put(Packer.EFFORT, &quot;7&quot;);  // default is &quot;5&quot;    // use largest-possible archive segments (&gt;10% better compression).    p.put(Packer.SEGMENT_LIMIT, &quot;-1&quot;);    // reorder files for better compression.    p.put(Packer.KEEP_FILE_ORDER, Packer.FALSE);    // smear modification times to a single value.    p.put(Packer.MODIFICATION_TIME, Packer.LATEST);    // ignore all JAR deflation requests,    // transmitting a single request to use &quot;store&quot; mode.    p.put(Packer.DEFLATE_HINT, Packer.FALSE);    // discard debug attributes    p.put(Packer.CODE_ATTRIBUTE_PFX+&quot;LineNumberTable&quot;, Packer.STRIP);    // throw an error if an attribute is unrecognized    p.put(Packer.UNKNOWN_ATTRIBUTE, Packer.ERROR);    // pass one class file uncompressed:    p.put(Packer.PASS_FILE_PFX+0, &quot;mutants/Rogue.class&quot;);    try {        JarFile jarFile = new JarFile(&quot;/tmp/testref.jar&quot;);        FileOutputStream fos = new FileOutputStream(&quot;/tmp/test.pack&quot;);        // Call the packer        packer.pack(jarFile, fos);        jarFile.close();        fos.close();                File f = new File(&quot;/tmp/test.pack&quot;);        FileOutputStream fostream = new FileOutputStream(&quot;/tmp/test.jar&quot;);        JarOutputStream jostream = new JarOutputStream(fostream);        Unpacker unpacker = Pack200.newUnpacker();        // Call the unpacker        unpacker.unpack(f, jostream);        // Must explicitly close the output.        jostream.close();    } catch (IOException ioe) {        ioe.printStackTrace();    } </pre></blockquote> <p>用 gzip 压缩的 Pack200 文件可以宿主在 HTTP/1.1 Web 服务器上。部署应用程序可以使用 &quot;Accept-Encoding=pack200-gzip&quot;。这向服务器指示客户机应用程序需要的是用 Pack200 编码并用 gzip 进一步压缩的文件版本。有关细节和技术的更多信息,请参阅《Java Deployment Guide》<TBD>。 <p>除非另行说明,否则将 <tt>null</tt> 参数传递给此类中的构造方法或方法都会抛出 <A HREF="../../lang/NullPointerException.html" title="java.lang 中的类"><CODE>NullPointerException</CODE></A>。<P><P><DL><DT><B>从以下版本开始:</B></DT>  <DD>1.5</DD></DL><HR><P><!-- ======== NESTED CLASS SUMMARY ======== --><A NAME="nested_class_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?