File[] files = folder.listFiles();
File file = null;
FileInputStream fin = null;
MimeMessage mm = null;
JasenScanResult result = null;
NumberFormat formatter = new DecimalFormat("0.000");
for (int i = 0; i < files.length; i++)
{
file = files[i];
if(file.isFile()) {
fin = new FileInputStream(file);
mm = new MimeMessage(null, fin);
fin.close();
System.out.println ("Scanning\t:\t" + file.getName());
result = JasenScanner.getInstance().scan(mm);
if(result.completed()) {
if(result.getProbability() >= command.high) {
if(command.lspam) {
System.out.print ("Result\t\t:\t");
System.out.println(formatter.format(result.getProbability()));
System.out.print ("Judgement\t:\t");
System.out.println ("Most likely SPAM");
System.out.println ("--------------------------------------------------------");
System.out.println ("");
if(command.drop != null) {
drop(command.drop, file);
}
}
spam++;
}
else if (result.getProbability() <= command.low) {
if(command.lham) {
System.out.print ("Result\t\t:\t");
System.out.println(formatter.format(result.getProbability()));
System.out.print ("Judgement\t:\t");
System.out.println ("Most likely HAM");
System.out.println ("--------------------------------------------------------");
System.out.println ("");
if(command.drop != null) {
drop(command.drop, file);
}
}
ham++;
}
else {
if(command.lborder) {
System.out.print ("Result\t\t:\t");
System.out.println(formatter.format(result.getProbability()));
System.out.print ("Judgement\t:\t");
System.out.println ("Can't be sure. Borderline case");
System.out.println ("--------------------------------------------------------");
System.out.println ("");
if(command.drop != null) {
drop(command.drop, file);
}
}
borderline++;
}
}
else
{
System.out.print ("Result\t\t:\t");
System.out.println (result.getTestResults()[0][0]);
error++;
}
}
}