ClasspathFileReader implements FileReader { @Nullable @Override public CharStream read(String name) { try { InputStream resource = readResource(name); if (resource != null) { return CharStreams.fromStream(resource); } } catch (Exception e) { LOGGER.error("Could not read {}", name, e); } return null; }  static InputStream readResource(String name); @Nullable @Override CharStream read(String name);  }
@Test public void testRead() throws Exception { ClasspathFileReader reader = new ClasspathFileReader(); CharStream a = reader.read("protostuff_unittest/messages_sample.proto"); CharStream b = reader.read("this_file_does_not_exist.proto"); assertNotNull(a); assertNull(b); }