此方法适用于以.txt结尾的url
private StringBuilder readFromUrl(String url) throws IOException {
InputStream is = new URL(url).openStream();
try {
BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
StringBuilder sb = new StringBuilder();
int cp;
while ((cp = rd.read()) != -1) {
sb.append((char) cp);
}
return sb;
} finally {
is.close();
}
}