首页 文章 daima1

daima1

2021-12-27 11:19  浏览数:601  来源:小键人3994802    

public class NetUtil {
public static String doGet(String url1) {
try {
URL url = new URL(url1);
HttpURLConnection Connection = (HttpURLConnection) url.openConnection();
if (Connection.getResponseCode() == 200) {
InputStream inputStream = Connection.getInputStream();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
StringBuilder stringBuilder = new StringBuilder();
for (String line = ""; (line = bufferedReader.readLine()) != null; ) {
stringBuilder.append(line);
}
return stringBuilder.toString();
}
} catch (Exception e) {
e.printStackTrace();
}
return "";
}



声明:以上文章均为用户自行添加,仅供打字交流使用,不代表本站观点,本站不承担任何法律责任,特此声明!如果有侵犯到您的权利,请及时联系我们删除。

字符:    改为:
去打字就可以设置个性皮肤啦!(O ^ ~ ^ O)