@Test public void testGetXmlSource() throws IOException { try (Reader r = loader.reader("dummy.xml")) { assertNotNull(r); char[] buffer = new char[100]; int read = r.read(buffer, 0, buffer.length); assertEquals("<dummy/>", new String(buffer, 0, read)); } }
@Override public Reader reader(String name) { URL modelUrl; try { modelUrl = new URL(baseUrl, name); } catch (MalformedURLException e) { throw new LmRuntimeException("Error building source URL", e); } LOGGER.info("Will extract XML from {}", modelUrl); try { return new InputStreamReader(modelUrl.openStream(), StandardCharsets.UTF_8); } catch (IOException e) { throw new LmRuntimeException("Error reading extractor config XML from URL " + modelUrl, e); } }
URLResourceResolver implements ResourceResolver { @Override public Reader reader(String name) { URL modelUrl; try { modelUrl = new URL(baseUrl, name); } catch (MalformedURLException e) { throw new LmRuntimeException("Error building source URL", e); } LOGGER.info("Will extract XML from {}", modelUrl); try { return new InputStreamReader(modelUrl.openStream(), StandardCharsets.UTF_8); } catch (IOException e) { throw new LmRuntimeException("Error reading extractor config XML from URL " + modelUrl, e); } } }
URLResourceResolver implements ResourceResolver { @Override public Reader reader(String name) { URL modelUrl; try { modelUrl = new URL(baseUrl, name); } catch (MalformedURLException e) { throw new LmRuntimeException("Error building source URL", e); } LOGGER.info("Will extract XML from {}", modelUrl); try { return new InputStreamReader(modelUrl.openStream(), StandardCharsets.UTF_8); } catch (IOException e) { throw new LmRuntimeException("Error reading extractor config XML from URL " + modelUrl, e); } } URLResourceResolver(URL baseUrl); }
URLResourceResolver implements ResourceResolver { @Override public Reader reader(String name) { URL modelUrl; try { modelUrl = new URL(baseUrl, name); } catch (MalformedURLException e) { throw new LmRuntimeException("Error building source URL", e); } LOGGER.info("Will extract XML from {}", modelUrl); try { return new InputStreamReader(modelUrl.openStream(), StandardCharsets.UTF_8); } catch (IOException e) { throw new LmRuntimeException("Error reading extractor config XML from URL " + modelUrl, e); } } URLResourceResolver(URL baseUrl); @Override Reader reader(String name); }
URLResourceResolver implements ResourceResolver { @Override public Reader reader(String name) { URL modelUrl; try { modelUrl = new URL(baseUrl, name); } catch (MalformedURLException e) { throw new LmRuntimeException("Error building source URL", e); } LOGGER.info("Will extract XML from {}", modelUrl); try { return new InputStreamReader(modelUrl.openStream(), StandardCharsets.UTF_8); } catch (IOException e) { throw new LmRuntimeException("Error reading extractor config XML from URL " + modelUrl, e); } } URLResourceResolver(URL baseUrl); @Override Reader reader(String name);  }