List of utility methods to do URL Load
String | readResource(URL resource) read Resource try (InputStream is = resource.openStream()) { Scanner s = new Scanner(is).useDelimiter(FILE_DELIMITER); return s.hasNext() ? s.next() : ""; |
void | readServicesFromUrl(Collection read Services From Url InputStream in = url.openStream(); try { if (in == null) return; BufferedReader r = new BufferedReader(new InputStreamReader(in, "UTF-8")); while (true) { String line = r.readLine(); if (line == null) ... |
String[] | readSqlStatements(URL url) Reads SQL statements from file. try { char buffer[] = new char[256]; StringBuilder result = new StringBuilder(); InputStreamReader reader = new InputStreamReader(url.openStream(), "UTF-8"); while (true) { int count = reader.read(buffer); if (count < 0) { break; ... |
Set | readStopwordsURL(URL url, boolean lowercase) read Stopwords URL return readStopwordsInputStream(url.openStream(), lowercase);
|
String | readStringFromUrl(URL url) Reads content from specified URL StringBuffer buffer = new StringBuffer(); BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); int ch; while ((ch = in.read()) != -1) { buffer.append((char) ch); in.close(); return buffer.toString(); ... |
String | readStringFromURL(URL url) read String From URL InputStream is = null; try { is = url.openStream(); } catch (IOException e) { return ""; return readStringFromInputStream(is); |
String | readText(final URL url) read Text String text = null; BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream())); StringBuilder sb = new StringBuilder(); String next; while ((next = br.readLine()) != null) { sb.append(next + System.getProperty("line.separator")); br.close(); ... |
String | readText(final URL url) Reads text from the specified URL. if (url == null) throw new IOException("File not found"); final InputStream stream = url.openStream(); try { final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); final byte[] buffer = new byte[8192]; int read; while ((read = stream.read(buffer)) > 0) { ... |
String | readTextFile(final URL resource) Reads a text file (UTF-8 encoding) from the specified resource. if (resource == null) throw new IOException("Resource not found"); try (final InputStream stream = resource.openStream()) { return readTextFile(stream); |
String | readTextFileAtUrl(final URL url) read Text File At Url BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream())); StringBuilder sb = new StringBuilder(); String inputLine; while ((inputLine = br.readLine()) != null) { sb.append(inputLine + "\n"); br.close(); return sb.toString(); ... |