当前页面: 开发资料首页 → JSP 专题 → 急:java如何通过http url读取远程文件
急:java如何通过http url读取远程文件
摘要: 急:java如何通过http url读取远程文件
如:读取http://192.168.1.1:8080/test.xml
谢谢!
URL url = new URL(path);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
BufferedInputStream br = new BufferedInputStream(connection.getInputStream());
int length = connection.getContentLength();
下面的操作就是读这个buffer
谢谢!