Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
webPage to string
import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; class Rextester { public static void main(String[] args) { try { String webPage = "http://www.google.com"; URL url = new URL(webPage); URLConnection urlConnection = url.openConnection(); InputStream is = urlConnection.getInputStream(); InputStreamReader isr = new InputStreamReader(is); int numCharsRead; char[] charArray = new char[1024]; StringBuffer sb = new StringBuffer(); while ((numCharsRead = isr.read(charArray)) > 0) { sb.append(charArray, 0, numCharsRead); } String result = sb.toString(); System.out.println("*** BEGIN ***"); System.out.println(result); System.out.println("*** END ***"); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }
run
|
edit
|
history
|
help
0
Armstrong number
Num ways to decode a string -Facebook interview
pow binary
Random and count of even numbers
Java
JAVA # 3 sayının En büyüğü
jb7.0 extends.override
sq-buzz
Problem: binary
java.