@Override final public void read(Model model, InputStream in, String base) { readImpl(model, FileUtils.asBufferedUTF8(in), base) ; }
@Override final public void read(Model model, InputStream in, String base) { readImpl(model, FileUtils.asBufferedUTF8(in), base) ; }
public static BufferedReader readerFromURL( String urlStr ) { try { return asBufferedUTF8( new URL(urlStr).openStream() ); } catch (java.net.MalformedURLException e) { // Try as a plain filename. try { return asBufferedUTF8( new FileInputStream( urlStr ) ); } catch (FileNotFoundException f) { throw new WrappedIOException( f ); } } catch (IOException e) { throw new WrappedIOException( e ); } }
public final void parse(UpdateSink sink, InputStream input) throws QueryParseException { // BOM processing moved to the grammar. Reader r = FileUtils.asBufferedUTF8(input) ; parse$(sink, r) ; }
/** Parse from an input stream and obtain an SSE item expression */ public static Item parse(InputStream in, PrefixMapping pmap) { Reader reader = FileUtils.asBufferedUTF8(in) ; return parse(reader, pmap) ; }
public static BufferedReader readerFromURL( String urlStr ) { try { return asBufferedUTF8( new URL(urlStr).openStream() ); } catch (java.net.MalformedURLException e) { // Try as a plain filename. try { return asBufferedUTF8( new FileInputStream( urlStr ) ); } catch (FileNotFoundException f) { throw new WrappedIOException( f ); } } catch (IOException e) { throw new WrappedIOException( e ); } }
@Override public void read(InputStream in, String baseURI, Lang lang, StreamRDF output, Context context) { read(FileUtils.asBufferedUTF8(in), baseURI, lang, output, context); }
/** Slurp up a whole file */ public String readWholeFileAsUTF8(InputStream in) { try (Reader r = FileUtils.asBufferedUTF8(in); StringWriter sw = new StringWriter(1024)) { char buff[] = new char[1024] ; while (true) { int l = r.read(buff) ; if ( l <= 0 ) break ; sw.write(buff, 0, l) ; } return sw.toString() ; } catch (IOException ex) { throw new WrappedIOException(ex) ; } }
/** Slurp up a whole file */ public String readWholeFileAsUTF8(InputStream in) { try (Reader r = FileUtils.asBufferedUTF8(in); StringWriter sw = new StringWriter(1024)) { char buff[] = new char[1024] ; while (true) { int l = r.read(buff) ; if ( l <= 0 ) break ; sw.write(buff, 0, l) ; } return sw.toString() ; } catch (IOException ex) { throw new WrappedIOException(ex) ; } }
/** * Answer the list of rules parsed from the given URL. * @throws RulesetNotFoundException */ public static List<Rule> rulesFromURL( String uri,BuiltinRegistry registry) { BufferedReader br = null; try { InputStream in = FileManager.get().open(uri); if (in == null) throw new RulesetNotFoundException( uri ); br = FileUtils.asBufferedUTF8( in ); return parseRules( Rule.rulesParserFromReader( br ) ); } finally { if (br != null) try { br.close(); } catch (IOException e2) {} } }
/** * Answer the list of rules parsed from the given URL. * @throws RulesetNotFoundException */ public static List<Rule> rulesFromURL( String uri,BuiltinRegistry registry) { BufferedReader br = null; try { InputStream in = FileManager.get().open(uri); if (in == null) throw new RulesetNotFoundException( uri ); br = FileUtils.asBufferedUTF8( in ); return parseRules( Rule.rulesParserFromReader( br ) ); } finally { if (br != null) try { br.close(); } catch (IOException e2) {} } }