@Test public void getInputStreamFromPackGzTempBlob() throws Exception { InputStream is = getClass().getResourceAsStream(REAL_PACK_GZ); when(tempBlob.get()).thenReturn(is); InputStream result = underTest.getJarFromPackGz(tempBlob); assertThat(result, is(instanceOf(InputStream.class))); }
public InputStream getJarFromPackGz(final TempBlob tempBlob) throws IOException { Path tempFile = createTempFile("pack-file", "jar.pack"); try (GZIPInputStream gzis = new GZIPInputStream(tempBlob.get()); OutputStream os = newOutputStream(tempFile)) { Unpacker unpacker = Pack200.newUnpacker(); try (JarOutputStream jos = new JarOutputStream(os)) { unpacker.unpack(gzis, jos); return newInputStream(tempFile); } } finally { Files.delete(tempFile); } }
TempBlobConverter extends ComponentSupport { public InputStream getJarFromPackGz(final TempBlob tempBlob) throws IOException { Path tempFile = createTempFile("pack-file", "jar.pack"); try (GZIPInputStream gzis = new GZIPInputStream(tempBlob.get()); OutputStream os = newOutputStream(tempFile)) { Unpacker unpacker = Pack200.newUnpacker(); try (JarOutputStream jos = new JarOutputStream(os)) { unpacker.unpack(gzis, jos); return newInputStream(tempFile); } } finally { Files.delete(tempFile); } } }
TempBlobConverter extends ComponentSupport { public InputStream getJarFromPackGz(final TempBlob tempBlob) throws IOException { Path tempFile = createTempFile("pack-file", "jar.pack"); try (GZIPInputStream gzis = new GZIPInputStream(tempBlob.get()); OutputStream os = newOutputStream(tempFile)) { Unpacker unpacker = Pack200.newUnpacker(); try (JarOutputStream jos = new JarOutputStream(os)) { unpacker.unpack(gzis, jos); return newInputStream(tempFile); } } finally { Files.delete(tempFile); } } TempBlobConverter(); }
TempBlobConverter extends ComponentSupport { public InputStream getJarFromPackGz(final TempBlob tempBlob) throws IOException { Path tempFile = createTempFile("pack-file", "jar.pack"); try (GZIPInputStream gzis = new GZIPInputStream(tempBlob.get()); OutputStream os = newOutputStream(tempFile)) { Unpacker unpacker = Pack200.newUnpacker(); try (JarOutputStream jos = new JarOutputStream(os)) { unpacker.unpack(gzis, jos); return newInputStream(tempFile); } } finally { Files.delete(tempFile); } } TempBlobConverter(); InputStream getJarFromPackGz(final TempBlob tempBlob); }
TempBlobConverter extends ComponentSupport { public InputStream getJarFromPackGz(final TempBlob tempBlob) throws IOException { Path tempFile = createTempFile("pack-file", "jar.pack"); try (GZIPInputStream gzis = new GZIPInputStream(tempBlob.get()); OutputStream os = newOutputStream(tempFile)) { Unpacker unpacker = Pack200.newUnpacker(); try (JarOutputStream jos = new JarOutputStream(os)) { unpacker.unpack(gzis, jos); return newInputStream(tempFile); } } finally { Files.delete(tempFile); } } TempBlobConverter(); InputStream getJarFromPackGz(final TempBlob tempBlob);  }