/** * read the contents from the named URL, write to a file. * * @param urlString the URL to read from. * @param file write to this file * @return status or error message. * @throws IOException if failure */ static public String readURLtoFileWithExceptions(String urlString, File file) throws IOException { return readURLtoFileWithExceptions(urlString, file, default_socket_buffersize); }
/** * read the contents from the named URL, write to a file. * * @param urlString the URL to read from. * @param file write to this file * @return status or error message. * @throws IOException if failure */ static public String readURLtoFileWithExceptions(String urlString, File file) throws IOException { return readURLtoFileWithExceptions(urlString, file, default_socket_buffersize); }
/** * read the contents from the named URL, write to a file. * * @param urlString the URL to read from. * @param file write to this file * @return status or error message. * @throws IOException if failure */ static public String readURLtoFileWithExceptions(String urlString, File file) throws IOException { return readURLtoFileWithExceptions(urlString, file, default_socket_buffersize); }
static public void copyURL(String url, String filenameOut, int bufferSize) throws IOException { File outFile = new File(filenameOut); long start = System.currentTimeMillis(); String ok = IO.readURLtoFileWithExceptions(url, outFile, bufferSize); double took = .001 * (System.currentTimeMillis() - start); double len = (double) outFile.length() / (1000 * 1000); double rate = len / took ; System.out.println(" copyURL (" + url + ") took = " + took + " sec; len= "+len+" Mbytes; rate = " + Format.d(rate, 3) + "Mb/sec ok="+ok); }
IO.readURLtoFileWithExceptions(uriString, file, buffer_size); try (InputStream fin = new BufferedInputStream( new FileInputStream(file), 50000)) {
IO.readURLtoFileWithExceptions(uriString, file, buffer_size); InputStream fin = new BufferedInputStream( new FileInputStream(file), 50000); try {
IO.readURLtoFileWithExceptions(uriString, file, buffer_size); try (InputStream fin = new BufferedInputStream( new FileInputStream(file), 50000)) {