3rd condition is not satisfying..
package com.codegym.task.task18.task1810;
import java.io.*;
import java.lang.*;
/*
DownloadException
Requirements:
1. The program should read file names from the console.
2. Use a FileInputStream to read from the files.
3. The program should work until the entered file is less than 1000 bytes.
4. The program should terminate with a DownloadException.
5. The FileInputStream must be closed.
*/
public class Solution {
public static void main(String[] args) throws DownloadException {
// TODO Auto-generated method stub
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String filename = null;
FileInputStream input;
try {
while(true){
filename = reader.readLine();
input = new FileInputStream(filename);
if(input.available() < 1000){
input.close();
throw new DownloadException("msg");
}else{
while(input.available() > 999) {
int data = input.read();
// System.out.println(data);
}
input.close();
throw new DownloadException("msg");
}
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static class DownloadException extends Exception {
DownloadException(String msg){
super(msg);
}
}
}