Here you can find the source of url2list(String sURL, String encoding)
public static List<String> url2list(String sURL, String encoding)
//package com.java2s; /*/* www . j a va2s. c o m*/ * (C) 2007-2012 Alibaba Group Holding Limited. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * Authors: * leiwen <chrisredfield1985@126.com> , boyan <killme2008@gmail.com> */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; import java.util.ArrayList; import java.util.List; public class Main { private static final String UTF_8 = "utf-8"; public static List<String> url2list(String sURL, String encoding) { try { URL url = new URL(sURL); URLConnection conn = url.openConnection(); InputStream is = conn.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader( is, encoding)); List<String> list = new ArrayList<String>(); String line; while ((line = br.readLine()) != null) { list.add(line); } return list; } catch (IOException e) { e.printStackTrace(); } return null; } public static List<String> url2list(String sURL) { return url2list(sURL, UTF_8); } }