I invoke someone from Codegym.
I can't really understand what should I do. Should I meet conditions or requirements?
I've also tried this task with try-catch and it failed. Can someone explain what conditions should this task meet or what's wrong in my solution?
package pl.codegym.task.task18.task1810;
/*
DownloadException
*/
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
public class Solution {
public static void main(String[] args) throws DownloadException, IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
FileInputStream inStream = new FileInputStream(reader.readLine());
byte[] buffer = new byte[inStream.available()];
while (inStream.available()>=0) {
inStream.read(buffer);
if (buffer.length>1000) {
throw new DownloadException();
}
}
inStream.close();
reader.close();
}//koniec main
public static class DownloadException extends Exception {}
}