Java访问url

2023-12-25 15:54:11 浏览数 (2)

代码语言:javascript复制
 try {
		            URL url = new URL("http://baiduu.com");
		            InputStream in =url.openStream();
		            InputStreamReader isr = new InputStreamReader(in);
		            BufferedReader bufr = new BufferedReader(isr);
		            String str;
		            while ((str = bufr.readLine()) != null) {
		                System.out.println(str);
		            }
		            bufr.close();
		            isr.close();
		            in.close();
		            Thread.sleep(100);
		        } catch (Exception e) {
		            e.printStackTrace();
		        }

妈妈在也不用担心博客访问量的问题了

0 人点赞