1 8 9 package com.sleepycat.je.util; 10 11 import java.io.File ; 12 import java.io.FilenameFilter ; 13 import java.util.StringTokenizer ; 14 15 public class BadFileFilter implements FilenameFilter { 16 17 21 public boolean accept(File dir, String name) { 22 boolean ok = false; 23 StringTokenizer tokenizer = new StringTokenizer (name, "."); 24 25 if (tokenizer.countTokens() == 3) { 26 String fileNumber = tokenizer.nextToken(); 27 String fileSuffix = tokenizer.nextToken(); 28 String repeat = tokenizer.nextToken(); 29 30 31 if ((fileNumber.length() == 8) && 32 (fileSuffix.equals("bad"))) { 33 34 35 try { 36 Integer.parseInt(fileNumber); 37 Integer.parseInt(repeat); 38 ok = true; 39 } catch (NumberFormatException e) { 40 ok = false; 41 } 42 } 43 } 44 45 return ok; 46 } 47 } 48 49 | Popular Tags |