📄 handleprotocoldemo.java
字号:
/*
* Created on 2007-9-24
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
import java.net.*;
import java.io.*;
/**
* @author Administrator
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class HandleProtocolDemo
{
public static void main(String args[])
{
try
{
URL url=new URL("http://www.xjtu.edu.cn/");
Object content=url.getContent();
if(content==null)
return;
System.out.println("class:"+content.getClass());
System.out.println("obj:"+content);
InputStream in=url.openStream();
if(in!=null)
{
for(int c=in.read();c>0;c=in.read())
System.out.println((char) c);
}
}
catch(MalformedURLException e)
{
e.printStackTrace();
}
catch(IOException e)
{
e.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -