获取到inputStream
// 根据url获取文件
URL url = new URL(URLDecoder.decode(ossUrl, "UTF-8"));
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
//设置超时间为30秒
conn.setConnectTimeout(30 * 1000);
InputStream inputStream = conn.getInputStream();
获取到inputStream
// 根据url获取文件
URL url = new URL(URLDecoder.decode(ossUrl, "UTF-8"));
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
//设置超时间为30秒
conn.setConnectTimeout(30 * 1000);
InputStream inputStream = conn.getInputStream();