@Test public void OpenStream_with_Resource() throws IOException { assertTrue(new RDFSource("classpath:/test.ttl", Format.TURTLE, "test:context").openStream() != null); assertTrue(new RDFSource("file:src/test/resources/test.ttl", Format.TURTLE, "test:context").openStream() != null); assertTrue(new RDFSource("classpath:/tes.ttl", Format.TURTLE, "test:context").openStream() == null); }
public InputStream openStream() throws IOException { if (input != null) { return input; } else if (resource == null) { throw new IllegalStateException(); } else if (resource.startsWith("classpath:")) { String name = resource.substring(10); if (name.startsWith("/")) { name = name.substring(1); } return RDFSource.class.getClassLoader().getResourceAsStream(name); } else { return new URL(resource).openStream(); } }
RDFSource { public InputStream openStream() throws IOException { if (input != null) { return input; } else if (resource == null) { throw new IllegalStateException(); } else if (resource.startsWith("classpath:")) { String name = resource.substring(10); if (name.startsWith("/")) { name = name.substring(1); } return RDFSource.class.getClassLoader().getResourceAsStream(name); } else { return new URL(resource).openStream(); } } }
RDFSource { public InputStream openStream() throws IOException { if (input != null) { return input; } else if (resource == null) { throw new IllegalStateException(); } else if (resource.startsWith("classpath:")) { String name = resource.substring(10); if (name.startsWith("/")) { name = name.substring(1); } return RDFSource.class.getClassLoader().getResourceAsStream(name); } else { return new URL(resource).openStream(); } } RDFSource(String resource, Format format, String context);  RDFSource(InputStream input, Format format, String context); }
RDFSource { public InputStream openStream() throws IOException { if (input != null) { return input; } else if (resource == null) { throw new IllegalStateException(); } else if (resource.startsWith("classpath:")) { String name = resource.substring(10); if (name.startsWith("/")) { name = name.substring(1); } return RDFSource.class.getClassLoader().getResourceAsStream(name); } else { return new URL(resource).openStream(); } } RDFSource(String resource, Format format, String context);  RDFSource(InputStream input, Format format, String context); String getContext(); Format getFormat(); String getResource(); InputStream openStream(); }
RDFSource { public InputStream openStream() throws IOException { if (input != null) { return input; } else if (resource == null) { throw new IllegalStateException(); } else if (resource.startsWith("classpath:")) { String name = resource.substring(10); if (name.startsWith("/")) { name = name.substring(1); } return RDFSource.class.getClassLoader().getResourceAsStream(name); } else { return new URL(resource).openStream(); } } RDFSource(String resource, Format format, String context);  RDFSource(InputStream input, Format format, String context); String getContext(); Format getFormat(); String getResource(); InputStream openStream();  }