@Test public void suppliesInputStream() throws Exception { File bundleFile = TestUtils.getTestDataFile(APP_BUNDLE); try (ZipFile zipFile = new ZipFile(bundleFile)) { ZipEntry entry = zipFile.getEntry("base/manifest/AndroidManifest.xml"); ZipFileData data = new ZipFileData(zipFile, entry); try (InputStream stream = data.getInputStream()) { stream.read(); assertThat(stream).isNotNull(); } } }
@Override @MustBeClosed public InputStream getInputStream() { checkState(inputStream == null, "input stream was already supplied and opened"); try { inputStream = zipFile.getInputStream(entry); } catch (IOException e) { throw new RuntimeException(e); } return inputStream; }
ZipFileData implements FileData { @Override @MustBeClosed public InputStream getInputStream() { checkState(inputStream == null, "input stream was already supplied and opened"); try { inputStream = zipFile.getInputStream(entry); } catch (IOException e) { throw new RuntimeException(e); } return inputStream; } }
ZipFileData implements FileData { @Override @MustBeClosed public InputStream getInputStream() { checkState(inputStream == null, "input stream was already supplied and opened"); try { inputStream = zipFile.getInputStream(entry); } catch (IOException e) { throw new RuntimeException(e); } return inputStream; } ZipFileData(ZipFile zipFile, ZipEntry entry); }
ZipFileData implements FileData { @Override @MustBeClosed public InputStream getInputStream() { checkState(inputStream == null, "input stream was already supplied and opened"); try { inputStream = zipFile.getInputStream(entry); } catch (IOException e) { throw new RuntimeException(e); } return inputStream; } ZipFileData(ZipFile zipFile, ZipEntry entry); @Override @MustBeClosed InputStream getInputStream(); @Override Path getPathWithinRoot(); @Override Path getPathWithinModule(); @Override long getSize(); long getCompressedSize(); }
ZipFileData implements FileData { @Override @MustBeClosed public InputStream getInputStream() { checkState(inputStream == null, "input stream was already supplied and opened"); try { inputStream = zipFile.getInputStream(entry); } catch (IOException e) { throw new RuntimeException(e); } return inputStream; } ZipFileData(ZipFile zipFile, ZipEntry entry); @Override @MustBeClosed InputStream getInputStream(); @Override Path getPathWithinRoot(); @Override Path getPathWithinModule(); @Override long getSize(); long getCompressedSize();  }