unpacker.unpack(tempFile, jos);
private Pack200CompressorInputStream(final InputStream in, final File f, final Pack200Strategy mode, final Map<String, String> props) throws IOException { originalInput = in; streamBridge = mode.newStreamBridge(); try (final JarOutputStream jarOut = new JarOutputStream(streamBridge)) { final Pack200.Unpacker u = Pack200.newUnpacker(); if (props != null) { u.properties().putAll(props); } if (f == null) { u.unpack(new FilterInputStream(in) { @Override public void close() { // unpack would close this stream but we // want to give the user code more control } }, jarOut); } else { u.unpack(f, jarOut); } } }
try unp.unpack( gzip, jos );
try unp.unpack( gzip, jos );
Pack200.newUnpacker().unpack(gzipInput, jarOut);
JarOutputStream jos = new JarOutputStream(jarBytes); Pack200.newUnpacker().unpack(temp, jos);
unpacker.unpack(tempFile, jos);
JarOutputStream jos = new JarOutputStream(jarBytes)) Pack200.newUnpacker().unpack(binpatchesDecompressed, jos);
unpacker.unpack(in, out);
unpacker.unpack(tempFile, jos);
JarOutputStream jos = new JarOutputStream(jarBytes); Pack200.newUnpacker().unpack(new ByteArrayInputStream(decompressed), jos);
/** * Unpacks a pack packFile. * * @param packFile the pack packFile meta-data * @param packInputStream the pack input stream * @param target the target * @throws IOException for any I/O error * @throws InstallerException for any installer exception */ @Override public void unpack(PackFile packFile, InputStream packInputStream, File target) throws IOException, InstallerException { InputStream in = IOUtils.buffer(packInputStream); JarOutputStream jarOut = null; try { jarOut = new JarOutputStream(getTarget(packFile, target)); Pack200.Unpacker unpacker = createPack200Unpacker(packFile); unpacker.unpack(in, jarOut); } finally { IOUtils.closeQuietly(jarOut); IOUtils.closeQuietly(in); } postCopy(packFile); }
public void close() throws IOException {} }; Pack200.newUnpacker().unpack(zin, out);
bos = new BufferedOutputStream(fos); jos = new JarOutputStream(bos); Pack200.newUnpacker().unpack(bis, jos); } finally { closeQuietly(jos);
/** * {@inheritDoc} */ public void unpack( File source, File destination, Map<String, String> props ) throws IOException { InputStream in = null; JarOutputStream out = null; try { in = new FileInputStream( source ); if ( isGzipped( source ) ) { in = new GZIPInputStream( in ); } in = new BufferedInputStream( in ); out = new JarOutputStream( new BufferedOutputStream( new FileOutputStream( destination ) ) ); Pack200.Unpacker unpacker = Pack200.newUnpacker(); unpacker.properties().putAll( props ); unpacker.unpack( in, out ); } finally { IOUtil.close( in ); IOUtil.close( out ); } }
private static Bundle installBundle(BundleContext context, String location) throws Exception { boolean pack = location.endsWith(PACK200_COMPRESSION); if (pack) { // Remove the pack classifier from the location path location = location.substring(0, location.length() - 8); pack = context.getBundle(location) == null; } if (pack) { final URL url = new URL(location + PACK200_COMPRESSION); final PipedInputStream in = new PipedInputStream(); try (final PipedOutputStream out = new PipedOutputStream(in)) { Thread t = new Thread(() -> { try (JarOutputStream jarStream = new JarOutputStream(out); GZIPInputStream gzStream = new GZIPInputStream(FileUtil.getAdaptedConnection(url).getInputStream())) { Unpacker unpacker = Pack200.newUnpacker(); unpacker.unpack(gzStream, jarStream); } catch (Exception e1) { System.err.println("Cannot install pack bundle: " + url); //$NON-NLS-1$ e1.printStackTrace(); } }); t.start(); return context.installBundle(location, in); } } return context.installBundle(location, FileUtil.getAdaptedConnection(new URI(location).toURL()).getInputStream()); }
private Pack200CompressorInputStream(final InputStream in, final File f, final Pack200Strategy mode, final Map<String, String> props) throws IOException { originalInput = in; streamBridge = mode.newStreamBridge(); try (final JarOutputStream jarOut = new JarOutputStream(streamBridge)) { final Pack200.Unpacker u = Pack200.newUnpacker(); if (props != null) { u.properties().putAll(props); } if (f == null) { u.unpack(new FilterInputStream(in) { @Override public void close() { // unpack would close this stream but we // want to give the user code more control } }, jarOut); } else { u.unpack(f, jarOut); } } }
private Pack200CompressorInputStream(final InputStream in, final File f, final Pack200Strategy mode, final Map<String, String> props) throws IOException { originalInput = in; streamBridge = mode.newStreamBridge(); try (final JarOutputStream jarOut = new JarOutputStream(streamBridge)) { final Pack200.Unpacker u = Pack200.newUnpacker(); if (props != null) { u.properties().putAll(props); } if (f == null) { u.unpack(new FilterInputStream(in) { @Override public void close() { // unpack would close this stream but we // want to give the user code more control } }, jarOut); } else { u.unpack(f, jarOut); } } }
private static byte[] unpack(byte[] data, File path) throws IOException { File output = new File(path.getAbsolutePath() + ".unpacked"); if (output.exists()) { output.delete(); } FileOutputStream jar = new FileOutputStream(output); JarOutputStream jos = new JarOutputStream(jar); Pack200.newUnpacker().unpack(new ByteArrayInputStream(data), jos); jos.close(); jar.close(); byte[] unpacked = Files.toByteArray(output); if (!DEBUG_SAVE_STAGES) { output.delete(); } return unpacked; }
/** * Unpack a stream in Pack200 format into a stream in JAR/ZIP format. * * @param input * stream in Pack200 format * @return stream in JAR/ZIP format * @throws IOException * in case of errors with the streams */ public static InputStream unpack(final InputStream input) throws IOException { final ByteArrayOutputStream buffer = new ByteArrayOutputStream(); final JarOutputStream jar = new JarOutputStream(buffer); Pack200.newUnpacker().unpack(new NoCloseInput(input), jar); jar.finish(); return new ByteArrayInputStream(buffer.toByteArray()); }