public String getContent() throws IOException { URL u = new URL(url); ByteArrayOutputStream baos = new ByteArrayOutputStream(); AbstractDownloader.copyStream(u.openStream(), baos); return new String(baos.toByteArray()); }
public static File download(String url, String fileName) throws IOException { URL u = new URL(url); File output = new File(AbstractDownloader.DOWNLOAD_DIR, fileName); try { FileOutputStream fos = new FileOutputStream(output); AbstractDownloader.copyStream(u.openStream(), fos); fos.close(); } catch (Exception e) { output.delete(); return null; } return output; }