您的位置:首页 > 运维架构 > Linux

登录linux时自动输出系统信息

2012-05-01 18:58 323 查看
public class SearchIP
{

public static void main (String[] args)
{
try
{
String arg = "202.96.209.6";
URL url = new URL("http://whois.pconline.com.cn/ip.jsp?ip=" + arg);
HttpURLConnection connect = (HttpURLConnection) url.openConnection();
InputStream is = connect.getInputStream();
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
byte[] buff = new byte[256];
int rc = 0;
while ((rc = is.read(buff, 0, 256)) > 0)
{
outStream.write(buff, 0, rc);
}
byte[] b = outStream.toByteArray();
// 关闭
outStream.close();
is.close();
connect.disconnect();
System.out.println(new String(b));
}
catch (Exception e)
{
e.printStackTrace();
}
}
}

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: