Java(Android) IOException: Authority expected at index 7: http://
I am trying to make this function download file from the internet. I pass two arguments to it: from - url to file on the net, to - local file path; The problem it throws IOException when opening stream: Authority expected at index 7: http:// Here is my code: private boolean downloadFile(String pathFrom, String pathTo) { URL url; ReadableByteChannel rbc; FileOutputStream fos; try { url = new URL(pathFrom); rbc = Channels.newChannel(url.openStream()); fos = new FileOutputStream(pathTo); fos.getChannel().transferFrom(rbc, 0, 1 << 24); return true; } catch (MalformedURLException e) { Log.e(TAG,