我不知道您如何使用URL类。如果发布摘要会更好。但是这是一种对我有用的方法。看看是否对您有帮助:
URL url = new URL(urlPath); URLConnection con = url.openConnection(); con.setConnectTimeout(connectTimeout); con.setReadTimeout(readTimeout); InputStream in = con.getInputStream();

我不知道您如何使用URL类。如果发布摘要会更好。但是这是一种对我有用的方法。看看是否对您有帮助:
URL url = new URL(urlPath); URLConnection con = url.openConnection(); con.setConnectTimeout(connectTimeout); con.setReadTimeout(readTimeout); InputStream in = con.getInputStream();