public static String getdata(String arg) throws Exception { try { // Check to see that a command parameter was entered if (arg == null || arg == "") { // Print message, pause, then exit System.err.println ("Invalid command parameters"); System.in.read(); System.exit(0); } // Create an URL instance URL url = new URL(arg); // Get an input stream for reading InputStream in = url.openStream(); // Create a buffered input stream for efficency BufferedInputStream bufIn = new BufferedInputStream(in); String output = new String(""); // Repeat until end of file for (;;) { int data = bufIn.read(); // Check for EOF if (data == -1) break; else { output = output + data; } } return output; } catch (MalformedURLException mue) { System.err.println ("Invalid URL"); } catch (IOException ioe) { System.err.println ("I/O Error - " + ioe); } }