@Test public void suppliesInputStream() throws Exception { File file = TestUtils.getTestDataFile(PATH); SystemFileData systemFileData = new SystemFileData(file, Paths.get("foobar")); try (InputStream stream = systemFileData.getInputStream()) { stream.read(); assertThat(stream).isNotNull(); } }
@Override @MustBeClosed public InputStream getInputStream() { checkState(inputStream == null, "input stream was already supplied and opened"); try { inputStream = new FileInputStream(file); } catch (IOException e) { throw new RuntimeException(e); } return inputStream; }
SystemFileData implements FileData { @Override @MustBeClosed public InputStream getInputStream() { checkState(inputStream == null, "input stream was already supplied and opened"); try { inputStream = new FileInputStream(file); } catch (IOException e) { throw new RuntimeException(e); } return inputStream; } }
SystemFileData implements FileData { @Override @MustBeClosed public InputStream getInputStream() { checkState(inputStream == null, "input stream was already supplied and opened"); try { inputStream = new FileInputStream(file); } catch (IOException e) { throw new RuntimeException(e); } return inputStream; } SystemFileData(File file, Path pathWithinRoot);  SystemFileData(File file, Path pathWithinRoot, Path pathWithinModule); }
SystemFileData implements FileData { @Override @MustBeClosed public InputStream getInputStream() { checkState(inputStream == null, "input stream was already supplied and opened"); try { inputStream = new FileInputStream(file); } catch (IOException e) { throw new RuntimeException(e); } return inputStream; } SystemFileData(File file, Path pathWithinRoot);  SystemFileData(File file, Path pathWithinRoot, Path pathWithinModule); @Override @MustBeClosed InputStream getInputStream(); @Override Path getPathWithinRoot(); @Override Path getPathWithinModule(); Path getSystemPath(); @Override long getSize(); }
SystemFileData implements FileData { @Override @MustBeClosed public InputStream getInputStream() { checkState(inputStream == null, "input stream was already supplied and opened"); try { inputStream = new FileInputStream(file); } catch (IOException e) { throw new RuntimeException(e); } return inputStream; } SystemFileData(File file, Path pathWithinRoot);  SystemFileData(File file, Path pathWithinRoot, Path pathWithinModule); @Override @MustBeClosed InputStream getInputStream(); @Override Path getPathWithinRoot(); @Override Path getPathWithinModule(); Path getSystemPath(); @Override long getSize();  }