package test;

import java.net.*;
import java.io.*;

/**
 * @author miya
 */
public class URLClient {

	public String getURL(String spec) throws Exception{

		//エラー処理とか無視

		URL url = new URL(spec);
		URLConnection con = url.openConnection();
		InputStream in = con.getInputStream();

		StringBuffer sb = new StringBuffer();
		int len;
		byte[] b = new byte[1024];
		
		while((len = in.read(b)) != -1){			
			sb.append(new String(b));
		}
	
		in.close();
				
		return sb.toString();
	}


	public static void main(String[] args) throws Exception{
		String s = new URLClient().getURL("http://muimi.com");
		System.out.println(s);

	}

}
