So I am making a program that renders pictures from .ppm files. I have got another version working but have now moved on to the other part which is reading multiple images from the same document and to basically use this to animate it with a small delay inbetween switching pictures, and then the following error has come up and am completely stumped by it:
java.io.ioexception is never thrown in body of corresponding try statement
Any help would be much appreciated.
public void renderAnimatedImage(){
String image = UI.askString("Filename: ");
int keepingCount =0; //Variables
int numCount = 1;
try{
Scanner fileScan = new Scanner(image); // making scanners
Scanner scan = new Scanner(image);
File myFile = new File(image); //making files
File myFile2 = new File(image);
int num = 0;
while(scan.hasNextLine()){
String Line = scan.nextLine();
Scanner keywordSc = new Scanner (Line);
while(keywordSc.hasNext()) {
String Keyword = keywordSc.next();
if (Keyword.equals("P3")) {
num++;
}
else { break; }
}
}
while (keepingCount< numCount) {
this.renderImageHelper(scan); // calling upon an earlier method which works.
keepingCount++;
}
}
catch(IOException e) {UI.printf("File failure %s \n", e); }
}