GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — java-tools/d0wnloader.java at master · javaarchive/java-tools
This repository was archived by the owner on Feb 29, 2024. It is now read-only.
Expand file tree/ Copy pathd0wnloader.javaMore file actions 47 lines (43 loc) · 1.71 KB / Copy pathd0wnloader.javaFile metadata and controls47 lines (43 loc) · 1.71 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.net.MalformedURLException; import java.net.URL; import java.nio.channels.Channels; import java.nio.channels.ReadableByteChannel; import javax.swing.JFrame; import javax.swing.JOptionPane; public class d0wnloader { private static JFrame temp; public static void download(String url, String out) throws IOException { System.out.println("DL "+url+" "+out); URL website; try { website = new URL(url); ReadableByteChannel rbc = Channels.newChannel(website.openStream()); FileOutputStream fos = new FileOutputStream(new File(out)); fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE ); fos.close(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); System.err.println("Internet error, press enter to proceed"); JOptionPane.showMessageDialog(temp , "Failed to download file due to a network error. Here's your debug data "+e.getMessage()); (new PrintWriter(new FileWriter("Warning_Download_Failed.warning"))).close(); } } public static void main(String[] args) throws Exception{ String repoBase = "https://raw.githubusercontent.com/"; // Need slash String repoEnd = "javaarchive/java-tools/master/"; // username/repo-name/branch/ String u = repoBase + repoEnd; temp = new JFrame("Download..."); download(u + "javatools.java","javatools.java"); download(u + "jt.java","jt.java"); download(u + "compilestandard.java","compilestandard.java"); JOptionPane.showMessageDialog(temp , "Downloader is done!"); temp.dispose(); } } |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |