`
cgf198171
  • 浏览: 692 次
  • 来自: ...
文章分类
社区版块
存档分类
最新评论

读取http和fileSystem资源通用方法

XML 
阅读更多
怕忘记,自己记录一下

public static void main(String[] args) throws URISyntaxException, IOException {
        // TODO Auto-generated method stub
//        Timer timer = new Timer();
//        timer.scheduleAtFixedRate(new MyTask(), 1, 1);
//        URL url = new URL("http://ec2-204-236-206-91.compute-1.amazonaws.com/resources/ford/general/xml/homepage.xml");
//        System.out.println(url.getProtocol());
        URI uri = new URI("http://ec2-184-73-32-9.compute-1.amazonaws.com/resources/ford/edge/2010/xml/HTML360.xml");
//        URI uri = new URI("file:///D:/workCode/ngbs/NGContent/FordVehicles/resources/ford/edge/2010/xml/models.xml");
        InputStream is = uri.toURL().openStream();
        System.out.println(is.available());
        System.out.println(uri.toString());
        System.out.println(uri.toURL().getPath());
        System.out.println(uri.toURL().getProtocol());
        System.out.println(uri.toURL().getContent());
    }
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics