import java.io.DataInputStream;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
public class HtmlDeneme {
@SuppressWarnings("deprecation")
public static void main(String[] args) {
URL url = null;
try {
url = new URL("http://twitter.com");
} catch (MalformedURLException e) {
e.printStackTrace();
}
URLConnection u = null;
try {
u = url.openConnection();
} catch (IOException e) {
e.printStackTrace();
}
DataInputStream in = null;
try {
in = new DataInputStream(u.getInputStream());
} catch (IOException e) {
e.printStackTrace();
}
String values= "";
while (true) {
String line = null;
try {
line = in.readLine();
} catch (IOException e) {
e.printStackTrace();
}
if (line == null)
break;
values += line + "\n";
}
System.out.println(values);
}
}
Hiç yorum yok:
Yorum Gönder