@Test public void OpenStream_with_Input() throws IOException { InputStream input = new ByteArrayInputStream("abc".getBytes("UTF-8")); RDFSource source = new RDFSource(input, Format.TURTLE, "test:context"); assertEquals("abc", new String(ByteStreams.toByteArray(source.openStream()), Charsets.UTF_8)); }
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();  }