package java2;



import java.io.BufferedReader;

import java.io.DataOutputStream;

import java.io.File;

import java.io.FileReader;

import java.io.IOException;

import java.io.InputStreamReader;

import java.net.HttpURLConnection;

import java.net.URL;

import java.net.URLEncoder;

import java.io.BufferedReader;  

import java.io.FileInputStream;  

import java.io.File;  

import java.net.HttpURLConnection;  

import java.net.URL;




public class Net {

private static String ENCODE = "GBK";

public static void main(String[] args) throws IOException

{

long begintime = System.currentTimeMillis();

    URL url = new URL("https://ss2.baidu.com/6ONYsjip0QIZ8tyhnq/it/u=3174088766,1723506295&fm=80");

    HttpURLConnection urlcon = (HttpURLConnection)url.openConnection();

    urlcon.connect();         //获取连接

    java.io.InputStream is = urlcon.getInputStream();

    BufferedReader buffer = new BufferedReader(new InputStreamReader(is));

    StringBuffer bs = new StringBuffer();

    String l = null;

    while((l=buffer.readLine())!=null){

        bs.append(l).append("/n");

    }

    System.out.println(bs.toString());

    System.out.println(" content-encode:"+urlcon.getContentEncoding());

    System.out.println(" content-length:"+urlcon.getContentLength());

    System.out.println(" content-type:"+urlcon.getContentType());

    System.out.println(" date:"+urlcon.getDate());    

    System.out.println("total time:"+(System.currentTimeMillis()-begintime)+"毫秒");

}}