InputStream from a URL

后端 未结 6 380
死守一世寂寞
死守一世寂寞 2020-12-02 14:41

How do I get an InputStream from a URL?

for example, I want to take the file at the url wwww.somewebsite.com/a.txt and read it as an InputStream in Java

6条回答
  •  独厮守ぢ
    2020-12-02 15:46

    Try:

    final InputStream is = new URL("http://wwww.somewebsite.com/a.txt").openStream();
    

提交回复
热议问题