JarFile jarFile = new JarFile(from)) { final Pack200.Packer packer = Pack200.newPacker(); packer.properties().putAll(props); packer.pack(jarFile, fos);
public void finish() throws IOException { if (!finished) { finished = true; final Pack200.Packer p = Pack200.newPacker(); if (properties != null) { p.properties().putAll(properties); } try (JarInputStream ji = new JarInputStream(streamBridge.getInput())) { p.pack(ji, originalOutput); } } } }
private byte[] pack200(byte[] data) throws Exception { JarInputStream in = new JarInputStream(new ByteArrayInputStream(data)); ByteArrayOutputStream out = new ByteArrayOutputStream(); Packer packer = Pack200.newPacker(); SortedMap<String, String> props = packer.properties(); props.put(Packer.EFFORT, "9"); props.put(Packer.KEEP_FILE_ORDER, Packer.TRUE); props.put(Packer.UNKNOWN_ATTRIBUTE, Packer.PASS); final PrintStream err = new PrintStream(System.err); System.setErr(new PrintStream(ByteStreams.nullOutputStream())); packer.pack(in, out); System.setErr(err); in.close(); out.close(); return out.toByteArray(); }
JarFile jarFile = new JarFile(from)) { final Pack200.Packer packer = Pack200.newPacker(); packer.properties().putAll(props); packer.pack(jarFile, fos);
JarFile jarFile = new JarFile(from)) { final Pack200.Packer packer = Pack200.newPacker(); packer.properties().putAll(props); packer.pack(jarFile, fos);
SortedMap<String, String> props = packer.properties(); props.put(Packer.EFFORT, "9"); props.put(Packer.KEEP_FILE_ORDER, Packer.TRUE);
packer.properties().putAll( props ); packer.pack( jar, out );
public void finish() throws IOException { if (!finished) { finished = true; final Pack200.Packer p = Pack200.newPacker(); if (properties != null) { p.properties().putAll(properties); } try (JarInputStream ji = new JarInputStream(streamBridge.getInput())) { p.pack(ji, originalOutput); } } } }
public void finish() throws IOException { if (!finished) { finished = true; final Pack200.Packer p = Pack200.newPacker(); if (properties != null) { p.properties().putAll(properties); } try (JarInputStream ji = new JarInputStream(streamBridge.getInput())) { p.pack(ji, originalOutput); } } } }
private Packer newPacker() { Packer packer = Pack200.newPacker(); // From Pack200.Packer javadoc: // ... the segment limit may also need to be set to "-1", // to prevent accidental variation of segment boundaries as class file sizes change slightly packer.properties().put(Packer.SEGMENT_LIMIT, "-1"); return packer; }
private Pack200.Packer createPack200Packer(PackFile packFile) { Pack200.Packer packer = Pack200.newPacker(); Map<String, String> defaultPackerProperties = packer.properties(); Map<String,String> localPackerProperties = packFile.getPack200Properties(); if (localPackerProperties != null) { defaultPackerProperties.putAll(localPackerProperties); } return packer; }
public void createArchive() throws ArchiverException, IOException { // Create the Packer object Packer packer = Pack200.newPacker(); packer.properties().putAll(getProperties()); JarFile jarFile = new JarFile(getSourceJar()); FileOutputStream fos = new FileOutputStream(getDestFile()); // Call the packer packer.pack(jarFile, fos); jarFile.close(); fos.close(); }