List of utility methods to do URL Load
String | readURL(String url, String charsetName) read URL try { java.net.URL u = new java.net.URL(url); return readAsText(u.openStream(), charsetName); } catch (Exception exp) { throw new RuntimeException("readURL error!", exp); |
ArrayList | ReadURL(String URLAddress) Reads data from an URLAddress to the string URL address; try { address = new URL(URLAddress); } catch (MalformedURLException ex) { return null; ArrayList<String> sb = new ArrayList(); try { ... |
String | readUrl(String urlString) read Url URL url = new URL(urlString); try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()))) { StringBuilder buffer = new StringBuilder(); int read; char[] chars = new char[1024]; while ((read = reader.read(chars)) != -1) buffer.append(chars, 0, read); return buffer.toString(); ... |
String | readURL(URL fileURL) read URL return readAll(new InputStreamReader(fileURL.openStream())); |
String | readURL(URL url) read URL final StringBuilder content = new StringBuilder(); final BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); String inputLine; while ((inputLine = in.readLine()) != null) content.append(inputLine); in.close(); return content.toString(); |
String | readURL(URL url) read URL try { InputStreamReader in = new InputStreamReader(url.openStream()); char[] buffer = new char[1024]; int l = 0; StringBuilder sb = new StringBuilder(); while ((l = in.read(buffer, 0, buffer.length)) > -1) { sb.append(buffer, 0, l); in.close(); return new String(sb); } catch (Exception e) { e.printStackTrace(); return null; |
String | readURL(URL url) read URL ByteArrayOutputStream baos = new ByteArrayOutputStream(); InputStream is = url.openStream(); int r; while ((r = is.read()) != -1) { baos.write(r); return new String(baos.toByteArray()); |
String | readURL(URL url) Read from a URL into a string String str = ""; BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); String inputLine; while ((inputLine = in.readLine()) != null) str += inputLine + "\n"; in.close(); return str; |
String | readUrl(URL url) read Url BufferedReader reader = null; StringBuilder buffer = new StringBuilder(); try { reader = new BufferedReader(new InputStreamReader(url.openStream())); int read; char[] chars = new char[1024]; while ((read = reader.read(chars)) != -1) buffer.append(chars, 0, read); ... |
String | readURLasString(URL url) read UR Las String InputStream openStream = url.openStream(); try { InputStreamReader inStream = new InputStreamReader(openStream); try { BufferedReader inReader = new BufferedReader(inStream); try { String oneLine = inReader.readLine(); if (oneLine == null) ... |