List of usage examples for com.google.common.io Resources getResource
public static URL getResource(String resourceName)
From source file:keywhiz.IntegrationTestRule.java
public static RuleChain rule() { String configPath = Resources.getResource("keywhiz-test.yaml").getPath(); return RuleChain.outerRule(new MigrationsRule()) .around(new DropwizardAppRule<>(KeywhizService.class, configPath)); }
From source file:io.knotx.junit.util.FileReader.java
static String readText(String path) throws IOException { return CharStreams.toString(new InputStreamReader(Resources.getResource(path).openStream(), "utf-8")); }
From source file:com.totango.discoveryagent.ResourceLoader.java
public static String load(String resourceName) { try {//from w w w . j a va 2 s . co m URL healthJsonURI = Resources.getResource(resourceName); CharSource healthJsonSource = Resources.asCharSource(healthJsonURI, Charsets.UTF_8); return healthJsonSource.read(); } catch (Throwable t) { throw new RuntimeException(t); } }
From source file:com.optimizely.ab.BenchmarkUtils.java
public static String getProfilingDatafile(String datafilePath) throws IOException { return Resources.toString(Resources.getResource(datafilePath), Charsets.UTF_8); }
From source file:com.spotify.docker.FixtureUtil.java
public static String fixture(final String filename) throws IOException { return Resources.toString(Resources.getResource(filename), Charsets.UTF_8).trim(); }
From source file:de.appsolve.padelcampus.utils.FileUtil.java
public static String getFileContents(String fileName) throws IOException { URL url = Resources.getResource(fileName); return Resources.toString(url, Charsets.UTF_8); }
From source file:org.tomitribe.beryllium.Utility.java
public static String fileContent(final String filePath) throws IOException { return Resources.toString(Resources.getResource(filePath), Charset.defaultCharset()); }
From source file:com.xiaomo.TimeMachine.kit.ResourceKit.java
public static Map<String, String> readProperties(String resourceName) { Properties properties = new Properties(); URL resource = Resources.getResource(resourceName); try {/*from ww w. j av a2 s. co m*/ properties.load(new InputStreamReader(resource.openStream(), "UTF-8")); } catch (Exception e) { throw Throwables.propagate(e); } return Maps.fromProperties(properties); }
From source file:example.BaseExample.java
protected static Path getFilePath(final String fileName) { try {/*from ww w.ja v a2 s. c o m*/ return Paths.get(Resources.getResource(fileName).toURI()); } catch (URISyntaxException e) { throw Throwables.propagate(e); } }
From source file:com.mobiaware.util.ResourceHelpers.java
private static String fixture(final String filename, final Charset charset) throws IOException { return Resources.toString(Resources.getResource(filename), charset).trim(); }