@Test public void open_stream() throws Exception { FileLocator locator = new FileLocator(); File fileToCopy = new File(getClass().getResource("/com/sonar/orchestrator/locator/FileLocatorTest/foo.txt").toURI()); InputStream input = locator.openInputStream(FileLocation.of(fileToCopy)); assertThat(IOUtils.toString(input)).isEqualTo("foo"); }
@Override public InputStream openInputStream(FileLocation location) { try { return new FileInputStream(location.getFile()); } catch (FileNotFoundException e) { throw new IllegalStateException("Fail to open stream of " + location, e); } }
FileLocator implements Locator<FileLocation> { @Override public InputStream openInputStream(FileLocation location) { try { return new FileInputStream(location.getFile()); } catch (FileNotFoundException e) { throw new IllegalStateException("Fail to open stream of " + location, e); } } }
FileLocator implements Locator<FileLocation> { @Override public InputStream openInputStream(FileLocation location) { try { return new FileInputStream(location.getFile()); } catch (FileNotFoundException e) { throw new IllegalStateException("Fail to open stream of " + location, e); } }  }
FileLocator implements Locator<FileLocation> { @Override public InputStream openInputStream(FileLocation location) { try { return new FileInputStream(location.getFile()); } catch (FileNotFoundException e) { throw new IllegalStateException("Fail to open stream of " + location, e); } }  @Override File locate(FileLocation location); @Override File copyToDirectory(FileLocation fileLocation, File toDir); @Override File copyToFile(FileLocation fileLocation, File toFile); @Override InputStream openInputStream(FileLocation location); }
FileLocator implements Locator<FileLocation> { @Override public InputStream openInputStream(FileLocation location) { try { return new FileInputStream(location.getFile()); } catch (FileNotFoundException e) { throw new IllegalStateException("Fail to open stream of " + location, e); } }  @Override File locate(FileLocation location); @Override File copyToDirectory(FileLocation fileLocation, File toDir); @Override File copyToFile(FileLocation fileLocation, File toFile); @Override InputStream openInputStream(FileLocation location);  }