Java Jar Usage _getPacker()

Here you can find the source of _getPacker()

Description

get Packer

License

Open Source License

Declaration

static private Pack200.Packer _getPacker() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Map;
import java.util.jar.*;

public class Main {
    static private Pack200.Packer _getPacker() {
        Pack200.Packer packer = Pack200.newPacker();

        // Initialize the state by setting the desired properties
        Map<String, String> p = packer.properties();
        // take more time choosing codings for better compression
        p.put(Pack200.Packer.EFFORT, "7"); // default is "5"
        // use largest-possible archive segments (>10% better compression).
        p.put(Pack200.Packer.SEGMENT_LIMIT, "-1");
        // reorder files for better compression.
        p.put(Pack200.Packer.KEEP_FILE_ORDER, Pack200.Packer.FALSE);
        // smear modification times to a single value.
        p.put(Pack200.Packer.MODIFICATION_TIME, Pack200.Packer.LATEST);
        // ignore all JAR deflation requests,
        // transmitting a single request to use "store" mode.
        p.put(Pack200.Packer.DEFLATE_HINT, Pack200.Packer.FALSE);
        // throw an error if an attribute is unrecognized
        p.put(Pack200.Packer.UNKNOWN_ATTRIBUTE, Pack200.Packer.ERROR);

        return packer;
    }//from w  ww  . ja va  2  s . co  m
}

Related

  1. allocateReadOnlyDictionary(final Attributes attributes)
  2. allocateReadOnlyI18nDictionary(final Attributes attributes, final ResourceBundle resourceBundle)
  3. checkJarValidity(String path)
  4. containsClass(JarFile jarFile, String agentRunnerClassName)