@Test public void testAsBufferedReader() throws IOException { String expected = "hello\nworld\n"; BufferedReader reader = Resources.asBufferedReader("resources-test/hello.txt"); String actual = CharStreams.toString(reader); assertEquals(expected, actual); }
public static BufferedReader asBufferedReader(String resource) { URL url = com.google.common.io.Resources.getResource(resource); try { CharSource charSource = com.google.common.io.Resources.asCharSource(url, Charsets.UTF_8); return charSource.openBufferedStream(); } catch (IOException ex) { throw new RuntimeException(ex); } }
Resources { public static BufferedReader asBufferedReader(String resource) { URL url = com.google.common.io.Resources.getResource(resource); try { CharSource charSource = com.google.common.io.Resources.asCharSource(url, Charsets.UTF_8); return charSource.openBufferedStream(); } catch (IOException ex) { throw new RuntimeException(ex); } } }
Resources { public static BufferedReader asBufferedReader(String resource) { URL url = com.google.common.io.Resources.getResource(resource); try { CharSource charSource = com.google.common.io.Resources.asCharSource(url, Charsets.UTF_8); return charSource.openBufferedStream(); } catch (IOException ex) { throw new RuntimeException(ex); } }  }
Resources { public static BufferedReader asBufferedReader(String resource) { URL url = com.google.common.io.Resources.getResource(resource); try { CharSource charSource = com.google.common.io.Resources.asCharSource(url, Charsets.UTF_8); return charSource.openBufferedStream(); } catch (IOException ex) { throw new RuntimeException(ex); } }  static String asString(String resource); static BufferedReader asBufferedReader(String resource); }
Resources { public static BufferedReader asBufferedReader(String resource) { URL url = com.google.common.io.Resources.getResource(resource); try { CharSource charSource = com.google.common.io.Resources.asCharSource(url, Charsets.UTF_8); return charSource.openBufferedStream(); } catch (IOException ex) { throw new RuntimeException(ex); } }  static String asString(String resource); static BufferedReader asBufferedReader(String resource);  }