1public static String URLReader(URL url) throws IOException {
2 StringBuilder sb = new StringBuilder();
3 String line;
4
5 InputStream in = url.openStream();
6 try {
7 BufferedReader reader = new BufferedReader(new InputStreamReader(in));
8 while ((line = reader.readLine()) != null) {
9 sb.append(line).append(System.lineSeparator());
10 }
11 } finally {
12 in.close();
13 }
14
15 return sb.toString();
16}
17