@Test public void fileDoesNotExist() { StreamPayload payload = new StreamPayload(() -> getClass().getResourceAsStream(SONATYPE_ZIP), UNKNOWN_SIZE, ContentTypes.TEXT_PLAIN); assertThat(underTest.fileExists(payload, ANYPATH, "does_not_exist.mod"), is(false)); }
public boolean fileExists(final Payload payload, final String path, final String fileName) { try (InputStream projectAsStream = payload.openInputStream()) { return extract(projectAsStream, fileName, (ZipInputStream z) -> new NullInputStream(-1)) != null; } catch (IOException e) { log.warn("Unable to open content {}", path, e); } return false; }
CompressedContentExtractor extends ComponentSupport { public boolean fileExists(final Payload payload, final String path, final String fileName) { try (InputStream projectAsStream = payload.openInputStream()) { return extract(projectAsStream, fileName, (ZipInputStream z) -> new NullInputStream(-1)) != null; } catch (IOException e) { log.warn("Unable to open content {}", path, e); } return false; } }
CompressedContentExtractor extends ComponentSupport { public boolean fileExists(final Payload payload, final String path, final String fileName) { try (InputStream projectAsStream = payload.openInputStream()) { return extract(projectAsStream, fileName, (ZipInputStream z) -> new NullInputStream(-1)) != null; } catch (IOException e) { log.warn("Unable to open content {}", path, e); } return false; }  }
CompressedContentExtractor extends ComponentSupport { public boolean fileExists(final Payload payload, final String path, final String fileName) { try (InputStream projectAsStream = payload.openInputStream()) { return extract(projectAsStream, fileName, (ZipInputStream z) -> new NullInputStream(-1)) != null; } catch (IOException e) { log.warn("Unable to open content {}", path, e); } return false; }  @Nullable InputStream extractFile(final InputStream projectAsStream, final String fileName); boolean fileExists(final Payload payload, final String path, final String fileName); }
CompressedContentExtractor extends ComponentSupport { public boolean fileExists(final Payload payload, final String path, final String fileName) { try (InputStream projectAsStream = payload.openInputStream()) { return extract(projectAsStream, fileName, (ZipInputStream z) -> new NullInputStream(-1)) != null; } catch (IOException e) { log.warn("Unable to open content {}", path, e); } return false; }  @Nullable InputStream extractFile(final InputStream projectAsStream, final String fileName); boolean fileExists(final Payload payload, final String path, final String fileName);  }