public static String readString(InputStream in) throws IOException { return readString(new InputStreamReader(in)); }
/** * Read the contents as a string from the given file. */ public static String readString(File file) throws IOException { FileInputStream in = new FileInputStream(file); try { return readString(in); } finally { in.close(); } }
/** * Load configuration settings from the specified file. * * @param file * the file to load from * @return the contents of the file as a String, or null if the file did not * exist * @throws IOException * if the contents of the file could not be read due to an I/O * problem */ public static String loadConfigurationContents(File file) throws IOException { String result = null; if (file.exists()) { result = IOUtil.readString(file); } return result; }
public String getQueryString() throws Exception { if (queryString == null) { InputStream stream = new URL(queryFileURL).openStream(); try { return IOUtil.readString(new InputStreamReader(stream, "UTF-8")); } finally { stream.close(); } } return queryString; }
protected final String readQueryString() throws IOException { InputStream stream = new URL(queryFileURL).openStream(); try { return IOUtil.readString(new InputStreamReader(stream, "UTF-8")); } finally { stream.close(); } }
private String readQueryString() throws IOException { InputStream stream = new URL(queryFileURL).openStream(); try { return IOUtil.readString(new InputStreamReader(stream, "UTF-8")); } finally { stream.close(); } }
protected String readUpdateString() throws IOException { InputStream stream = new URL(requestFileURL).openStream(); try { return IOUtil.readString(new InputStreamReader(stream, "UTF-8")); } finally { stream.close(); } }
private String readUpdateString() throws IOException { InputStream stream = new URL(requestFileURL).openStream(); try { return IOUtil.readString(new InputStreamReader(stream, "UTF-8")); } finally { stream.close(); } }
protected final String readQueryString() throws IOException { InputStream stream = new URL(queryFileURL).openStream(); try { return IOUtil.readString(new InputStreamReader(stream, "UTF-8")); } finally { stream.close(); } }
/** * Read the query string from the specified resource * * @param queryResource * @return * @throws RepositoryException * @throws IOException */ private String readQueryString(final String queryResource) throws RepositoryException, IOException { final InputStream stream = TestFederatedQuery.class .getResourceAsStream(TEST_RESOURCE_PATH + queryResource); try { return IOUtil.readString(new InputStreamReader(stream, "UTF-8")); } finally { stream.close(); } }
private String readQuery() throws IOException { InputStream stream = url(queryFile).openStream(); try { return IOUtil.readString(new InputStreamReader(stream, "UTF-8")); } finally { stream.close(); } }
public static String readString(URL url) throws IOException { Reader reader = urlToReader(url); try { return readString(reader); } finally { reader.close(); } }
protected String readInputData(Dataset dataset) throws Exception { final StringBuilder sb = new StringBuilder(); if (dataset != null) { Set<URI> graphURIs = new HashSet<URI>(); graphURIs.addAll(dataset.getDefaultGraphs()); graphURIs.addAll(dataset.getNamedGraphs()); for (Resource graphURI : graphURIs) { URL graphURL = new URL(graphURI.toString()); InputStream in = graphURL.openStream(); sb.append(IOUtil.readString(in)); } } return sb.toString(); }
protected TupleExpr loadQuery(final String fileName) throws Exception { InputStream in = RDFStreamProcessor.class.getResourceAsStream(fileName); String query = IOUtil.readString(in); in.close(); ParsedQuery pq = queryParser.parseQuery(query, BASE_IRI); return pq.getTupleExpr(); }
protected String readUpdateString() throws IOException { InputStream stream = new URL(requestFileURL).openStream(); try { return IOUtil.readString(new InputStreamReader(stream, "UTF-8")); } finally { stream.close(); } }
public String getQueryString() throws Exception { if (queryString == null) { InputStream stream = new URL(queryFileURL).openStream(); try { return IOUtil.readString(new InputStreamReader(stream, "UTF-8")); } finally { stream.close(); } } return queryString; }
protected final String readQueryString() throws IOException { InputStream stream = new URL(queryFileURL).openStream(); try { return IOUtil.readString(new InputStreamReader(stream, "UTF-8")); } finally { stream.close(); } }
/** * Read the query string from the specified resource * * @param queryResource * @return * @throws RepositoryException * @throws IOException */ private String readQueryString(final String queryResource) throws RepositoryException, IOException { final InputStream stream = TestFederatedQuery.class .getResourceAsStream(TEST_RESOURCE_PATH + queryResource); try { return IOUtil.readString(new InputStreamReader(stream, "UTF-8")); } finally { stream.close(); } }
private void prepareForWire() throws Exception { if (file != null) { // set the data data = IOUtil.readBytes(file); } else if (is != null) { // set the data data = IOUtil.readBytes(is); } else if (reader != null) { // set the data data = IOUtil.readString(reader).getBytes(); } else if (stmts != null) { // set the data and content type (TRIG by default) format = RDFFormat.TRIG; data = serialize(stmts, format); } }
protected String readInputData(Dataset dataset) throws Exception { final StringBuilder sb = new StringBuilder(); if (dataset != null) { Set<URI> graphURIs = new HashSet<URI>(); graphURIs.addAll(dataset.getDefaultGraphs()); graphURIs.addAll(dataset.getNamedGraphs()); for (Resource graphURI : graphURIs) { URL graphURL = new URL(graphURI.toString()); InputStream in = graphURL.openStream(); sb.append(IOUtil.readString(in)); } } return sb.toString(); }