package URL;
import java.io.InputStream;
import java.net.URL;
public class openStream {
public static void main(String args[]){
try {
URL url=new URL("http://www.google.com");
InputStream is=url.openStream();
byte buffer[]=new byte[1024];
int i;
while((i=is.read(buffer))!=-1){
System.out.write(buffer,0,i);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
'Java' 카테고리의 다른 글
Runtime : addShutdownHook(Thread hook) (0) | 2015.01.28 |
---|---|
Runtime : availableProcessors() (0) | 2015.01.28 |
URL : openConnection() (0) | 2015.01.25 |
URL : getAuthority() (0) | 2015.01.25 |
new URL(String spec) throws MalformedURLException (0) | 2015.01.25 |