GitBucket
4.20.0
Toggle navigation
Sign in
Files
Branches
1
Tags
Issues
4
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
Jonathan
/
KA-Visual
Browse code
Added download URL function.
master
1 parent
d0c841c
commit
dafb379f64e6087e08e181b8781d8760420c6cfd
Jonathan Ström
authored
on 21 Feb 2017
Patch
Showing
1 changed file
src/mainClass.java
Ignore Space
Show notes
View
src/mainClass.java
import java.net.MalformedURLException; import java.net.URL; import java.io.*; public class mainClass { public static void main(String[] args) { getUrl("http://kryssakuten.se"); } public static void getUrl(String urlString) { URL url; InputStream is = null; BufferedReader br; String line; try { url = new URL(urlString); is = url.openStream(); // throws an IOException br = new BufferedReader(new InputStreamReader(is)); while ((line = br.readLine()) != null) { System.out.println(line); } } catch (MalformedURLException mue) { mue.printStackTrace(); } catch (IOException ioe) { ioe.printStackTrace(); } finally { try { if (is != null) is.close(); } catch (IOException ioe) { // nothing to see here } } } }
public class mainClass { public static void main(String[] args) { } }
Show line notes below