Hello. There is a code that downloads a file from the Internet.
private static void downloadUsingStream(String urlStr, String file) throws IOException{ URL url = new URL(urlStr); BufferedInputStream bis = new BufferedInputStream(url.openStream()); FileOutputStream fis = new FileOutputStream(file); byte[] buffer = new byte[1024]; int count=0; while((count = bis.read(buffer,0,1024)) != -1) { fis.write(buffer, 0, count); } fis.close(); bis.close(); } A couple of weeks ago, the file was downloaded as it should. And today I noticed that it does not swing. I began to understand, there are no errors, but I found out that for some reason 180Kb of 9Mb is downloaded. What am I doing wrong and how to solve the problem?