---
title: "URL 读取"
author: "sanpic"
date: "2014-07-27T17:08:43Z"
tags: []
categories: ["编程语言"]
slug: "url"
draft: false
lastmod: "2014-07-27T17:10:21Z"
id: 2096930
url: "https://sanpic.iteye.com/blog/2096930"
---

```
	@Test(timeout=1000)
	public void fun1() throws Exception {
		String urlStr="http........";
		URL url=new URL(urlStr);
		BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
		String str;
        while((str = in.readLine()) != null)
                System.out.println(str);
        in.close();
	}
```