private void TextButtonActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_TextButtonActionPerformed
    // TODO add your handling code here:
    try {

      int selectedrowindex = PacketInfoTable.getSelectedRow();

      long selectedTimeStamp =
          Long.parseLong((String) PacketInfoTable.getValueAt(selectedrowindex, 6));
      System.out.println(
          "Selected row index:" + selectedrowindex + "select time stamp:" + selectedTimeStamp);
      FileHandler file = new FileHandler();
      String returndata = file.fileReader(String.valueOf(selectedTimeStamp));
      try {
        // ResultSet PacketData = MainThread.stmt.executeQuery("select * from PacketInfo where
        // time_stamp=" + selectedTimeStamp);
        // if( PacketData.next())
        PacketDataTextArea.setText(returndata);
      } catch (Exception ex) {
        System.out.println("Retrieve Error: SQL " + ex);

        // Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex);
      }
    } catch (ArrayIndexOutOfBoundsException e) {
      new SelectPacketDialog(this, true);
    }
  } // GEN-LAST:event_TextButtonActionPerformed
Exemple #2
0
  public void handleInit(QuickServer quickserver) throws Exception {
    Logger logger = null;
    FileHandler xmlLog = null;
    File log = new File("./log/");
    if (!log.canRead()) log.mkdir();
    try {
      logger = Logger.getLogger("");
      logger.setLevel(Level.FINEST);

      logger = Logger.getLogger("org.quickserver.net.qsadmin");
      xmlLog = new FileHandler("log/FtpServer_QSAdmin%u%g.xml", 1024 * 1024, 20, true);
      xmlLog.setLevel(Level.FINEST);
      logger.addHandler(xmlLog);

      logger = Logger.getLogger("org.quickserver");
      xmlLog = new FileHandler("log/FtpServer_QuickServer%u%g.xml", 1024 * 1024, 20, true);
      xmlLog.setLevel(Level.FINEST);
      logger.addHandler(xmlLog);

      logger = Logger.getLogger("ftpserver");
      xmlLog = new FileHandler("log/FtpServer%u%g.xml", 1024 * 1024, 20, true);
      xmlLog.setLevel(Level.FINEST);
      logger.addHandler(xmlLog);

      quickserver.setAppLogger(logger); // img
    } catch (IOException e) {
      System.err.println("Could not create txtLog FileHandler : " + e);
      throw e;
    }
  }
Exemple #3
0
  public static void main(String[] args) {
    FileHandler fh = new FileHandler();
    Contact c = new Contact();
    List<Contact> contactList = new ArrayList<Contact>();

    String[] fields = fh.readFile(new File("/names.txt"));
    for (int i = 0; i < fields.length; i++) {
      if (!(fields[i].equals("-----"))) {
        c.setFirstName(fields[i++]);
        c.setLastName(fields[i++]);
        c.setAddress(fields[i++]);
        c.setCity(fields[i++]);
        c.setState(fields[i++]);
        c.setZip(fields[i++]);
        c.setEmail(fields[i++]);
        c.setPhone(fields[i++]);
      }
      contactList.add(c);
    }
    for (int i = 0; i < contactList.size(); i++) {
      System.out.println(
          contactList.get(i).getFirstName() + " " + contactList.get(i).getLastName());
      System.out.println(contactList.get(i).getAddress());
      System.out.println(
          contactList.get(i).getCity()
              + ", "
              + contactList.get(i).getState()
              + "  "
              + contactList.get(i).getZip());
      System.out.println(contactList.get(i).getPhone());
      System.out.println(contactList.get(i).getEmail());
      System.out.println();
    }
  }
  private void setupLogging() throws IOException {
    System.out.println("Setting up logging...");
    Level level = LogHelper.getLogLevel(m_testData.getLogLevel());
    if (level == null) {
      System.err.println("No such log level and will use Level.INFO instead");
      level = Level.INFO;
    }
    fh = new FileHandler(m_testData.getLogFile(), false);
    // have to change the log level of the handler to let log come out as designed
    fh.setLevel(level);

    // change the formatter from default xml to simple text
    fh.setFormatter(new SimpleFormatter());
    theLogger.setLevel(level);
    theLogger.addHandler(fh);

    // close the Console handler so that we only need log in file
    Handler[] handlers = Logger.getLogger("").getHandlers();
    for (Handler handler : handlers) {
      if (handler instanceof ConsoleHandler) {
        handler.setLevel(Level.OFF);
        break;
      }
    }
  }
Exemple #5
0
 /**
  * Loads and starts convert for new file format
  *
  * @param worlds world list
  */
 public void convert() {
   if (FH.pathExists("Undo Saves") && !FH.pathExists("Saves")) {
     GiantTrees.logInfo("Converting old files to new format...");
     GiantTrees.logInfo("DO NOT shutdown the server during this process!");
     Convert C = new Convert();
     C.doConversion();
     GiantTrees.logInfo("Done! Thanks for your patience!");
   }
 }
  @Override
  public boolean load() {
    groups = new HashMap<String, Group>();
    groupsint = new HashMap<Integer, Group>();
    accesslevels = new HashMap<String, AccessLevel>();
    accesslevelsint = new HashMap<Integer, AccessLevel>();

    List<String> lines = FileHandler.getLines("groups");

    Group group;
    LineReader r;
    int id;
    String name, commands, worlds;
    for (int i = 0; i < lines.size(); i++) {

      r = new LineReader(lines.get(i));
      id = r.nextInt();
      name = r.nextStr();
      commands = r.nextStr();
      worlds = r.nextStr();
      group = new Group(id, name, commands, worlds);

      groups.put(group.getName(), group);
      groupsint.put(group.getId(), group);
    }

    FFLog.newInit("Accessgroups", groups.size());

    List<String> lines2 = FileHandler.getLines("accesslevels");
    AccessLevel access;
    String usernameformat, accessgroups;
    Boolean admingroup, canbuild;
    for (int i = 0; i < lines2.size(); i++) {

      r = new LineReader(lines2.get(i));
      id = r.nextInt();
      name = r.nextStr();
      usernameformat = r.nextStr();
      accessgroups = r.nextStr();
      admingroup = r.nextBool();
      canbuild = r.nextBool();

      access =
          new AccessLevel(id, getGroups(accessgroups), name, usernameformat, canbuild, admingroup);

      accesslevels.put(access.getName(), access);
      accesslevelsint.put(access.getId(), access);
    }

    FFLog.newInit("Accesslevels", accesslevels.size());

    return true;
  }
Exemple #7
0
 private void init(State state) {
   if (state == State.GAME) { // If the state is ingame...
     level = Level.createLevel(0); // Load the spawn level (level 0)
     TileCoordinate playerSpawn =
         new TileCoordinate(
             15,
             60); // Create player coodinates. This class creates coordinates from pixels and
                  // converts it to tile coordinates (16 pixels -> 1 tile)
     String playerName = ""; // Initiate the players name
     if (FileHandler.fileExists(FileHandler.localUserFile))
       playerName =
           FileHandler
               .getPlayerName(); // If the player already exists, set the players name to the
                                 // stored name
     else
       playerName =
           sc
               .getPlayerName(); // Otherwise retrieve the name from the start screen that the user
                                 // has typed into the name box
     player =
         new Player(
             playerName,
             playerSpawn.x(),
             playerSpawn.y(),
             key); // Create a new player. Pass in the name, spawn location (in tile coordinates),
                   // and the keyboard class.
     changeLevel(
         Level
             .activeLevel); // Set the level to the current level (0, as we set that in the
                            // beginning)
     FileHandler.save(player); // Save everything
     initPause = false; // Set pause to false, just in case it is true
     c.clearTextArea(); // Clear the console
     System.out.println(
         "Controls: \n W/up -> Player up \n A/left -> Player left \n S/down -> Player down \n D/right -> Player right \n "
             + "Q -> Inventory \n Shift -> Sprint \n HOME -> home level \n M -> Map \n numbers 1-6 -> Weapons"); // Output the controls so the user can see what to do
   } else if (state == State.START) { // If the state is the start screen...
     sc = new StartScreen(); // Initiate the start screen
     uiManager.addPanel(
         sc); // Add the startscreen to the UI manager, which will render and update it
   } else if (state == State.PAUSE) { // If the state is in pause...
     pause = new Pause(); // Instantiate a new pause menu
     uiManager.addPanel(
         pause); // Add the pause menu to the UI manager, ready for rendering and updating
     initPause = true; // Tell the game we have created a pause menu (prevent more than 1 opening)
     paused = true; // Tell the game we are paused
   }
   STATE =
       State
           .WAITING; // Once the correct state is set up, set the state wo WAITING, which tells the
                     // game we are waiting for the state to change.
 }
Exemple #8
0
 /**
  * Creates world folders if they don't exist
  *
  * @param worlds world list
  */
 public void load(List<World> worlds) {
   String worldName, path;
   String[] treeFile = new String[1];
   do {
     worldName = worlds.remove(0).getName();
     path = "Saves" + FH.separator + worldName + FH.separator + "CurrentTree.dat";
     if (!FH.pathExists(path)) {
       GiantTrees.logInfo("Creating new world folder: " + worldName);
       treeFile[0] = "0";
       FH.write(treeFile, path);
     }
   } while (!worlds.isEmpty());
 }
Exemple #9
0
 private static void configLogging() {
   // Logger globalLogger = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
   Logger globalLogger = Logger.getLogger("");
   try {
     for (Handler h : globalLogger.getHandlers()) globalLogger.removeHandler(h);
     FileHandler fh = new FileHandler("schedule-creation-log.txt");
     fh.setFormatter(new CleanFormatter());
     globalLogger.addHandler(fh);
     globalLogger.setLevel(Level.ALL);
   } catch (IOException ioe) {
     ioe.printStackTrace();
   }
 }
  private void xmlLoaded() {
    String xmlPathB = "XML/UnitFontMappingsB.xml";
    String xmlPathC = "XML/UnitFontMappingsC.xml";

    InputStream xmlStreamB = this.getClass().getClassLoader().getResourceAsStream(xmlPathB);
    InputStream xmlStreamC = this.getClass().getClassLoader().getResourceAsStream(xmlPathC);

    String lookupXmlB = FileHandler.InputStreamToString(xmlStreamB);
    String lookupXmlC = FileHandler.InputStreamToString(xmlStreamC);

    populateLookup(lookupXmlB, RendererSettings.Symbology_2525Bch2_USAS_13_14);
    populateLookup(lookupXmlC, RendererSettings.Symbology_2525C);
  }
  /**
   * Test that the file system manager can insert an XML element into a file.
   *
   * @throws Exception If anything goes wrong
   */
  public void testManagerCanInsertAnElementIntoFile() throws Exception {
    Document document = DocumentHelper.createDocument();
    document.addElement("Application");
    util.saveXml(document, TEST_FILE);
    fileHandler.createFile(TEST_FILE);
    manager.setFile(TEST_FILE);
    manager.loadFile();
    manager.insertElementsUnderXPath("<subnode property='hello' />", "//Application");
    manager.writeFile();

    String xml = fileHandler.readTextFile(TEST_FILE, "UTF-8");

    XMLAssert.assertXpathEvaluatesTo("hello", "//Application/subnode/@property", xml);
  }
Exemple #12
0
  public void update() {
    time++; // Increase the time value by one updated 60 times per second, so if (time % 60) == 0,
            // one second has passed)
    if (key.paused && !initPause)
      STATE =
          State
              .PAUSE; // If the pause key is being pressed and pause menue hasn't been made, set the
                      // game state to pause
    else if (key.paused
        && initPause) // If we press the pause key and we have created pause, return to the game
                      // state
    STATE = State.GAME;
    if (time % 1800 == 0
        && player != null) // If 30 seconds has passed, and the player exists, then save the game
    FileHandler.save(player);
    init(STATE); // Call the initiate state method, in case it is changed during the game
    key.update(); // Update the key detector

    // Update layers
    for (int i = 0; i < UILayerStack.size(); i++) {
      UILayerStack.get(i).update();
    }
    for (int i = 0; i < layerStack.size(); i++) {
      layerStack.get(i).update();
    }
  }
Exemple #13
0
  public void addMessage(String message) {
    if (message != null) {
      messages.add(message);

      FileHandler.saveCaches();
    }
  }
  /**
   * Actual entry point.
   *
   * @param args application parameters.
   */
  public static void go(String[] args) {
    FileHandler file = new LocalFileHandler();
    IRCConfiguration ircConfiguration;
    StartupConfiguration startupConfiguration;

    try {

      if ((args.length == 0) || ((args.length >= 2) && (args[0].equals("-f")))) {
        String f = "pjirc.cfg";
        if (args.length >= 2) f = args[1];
        StreamParameterProvider provider = new StreamParameterProvider(file.getInputStream(f));
        ConfigurationLoader loader =
            new ConfigurationLoader(
                provider, new NullURLHandler(), new AWTImageLoader(), new NullSoundHandler(), file);
        ircConfiguration = loader.loadIRCConfiguration();
        startupConfiguration = loader.loadStartupConfiguration();
      } else if ((args.length >= 5) && (args[0].equals("-p"))) {
        StreamParameterProvider provider = new StreamParameterProvider(null);
        ConfigurationLoader loader =
            new ConfigurationLoader(
                provider, new NullURLHandler(), new AWTImageLoader(), new NullSoundHandler(), file);
        ircConfiguration = loader.loadIRCConfiguration();
        ircConfiguration.set("gui", args[4]);
        startupConfiguration =
            new StartupConfiguration(
                args[1],
                "",
                args[2],
                new String[] {""},
                new String[] {args[3]},
                new int[] {6667},
                "",
                new String[] {},
                new String[] {},
                true); // last value "true" set smileys to true by default
      } else {
        usage();
        return;
      }

      IRCApplication application = new IRCApplication(ircConfiguration, startupConfiguration, null);
      EventDispatcher.dispatchEventAsyncAndWaitEx(application, "init", new Object[0]);
    } catch (Throwable ex) {
      System.out.println("Error : " + ex.getMessage());
      ex.printStackTrace();
    }
  }
  /**
   * Test that the file system manager can insert an XML element with a namespace.
   *
   * @throws Exception If anything goes wrong
   */
  public void testManagerCanInsertAnElementIntoFileWithNamespace() throws Exception {
    Document document = DocumentHelper.createDocument();
    Element domain = document.addElement("domain");
    document.setRootElement(domain);
    domain.addNamespace("", "http://www.bea.com/ns/weblogic/920/domain");
    util.saveXml(document, TEST_FILE);
    fileHandler.createFile(TEST_FILE);
    manager.setNamespaces(namespaces);
    manager.setFile(TEST_FILE);
    manager.loadFile();
    manager.insertElementsUnderXPath("<subnode property='hello' />", "//weblogic:domain");
    manager.writeFile();

    String xml = fileHandler.readTextFile(TEST_FILE, "UTF-8");

    XMLAssert.assertXpathEvaluatesTo("hello", "//weblogic:domain/weblogic:subnode/@property", xml);
  }
Exemple #16
0
  public void loadMap(File file) {

    if (file.exists() && file.canRead()) {
      _map = (Map) _fileHandler.openData(file);

      notifyNewMapLoaded();
    }
  }
Exemple #17
0
 private void walk(File parent, FileHandler fileHandler) {
   if (parent.isDirectory()) {
     for (File child : parent.listFiles()) {
       walk(child, fileHandler);
     }
   } else {
     fileHandler.handle(parent);
   }
 }
Exemple #18
0
  /** Set up reflection methods required by the loader */
  @SuppressWarnings("unchecked")
  private boolean prepareLoader() {
    try {
      // addURL method is used by the class loader to
      mAddUrl = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
      mAddUrl.setAccessible(true);

      Formatter minecraftLogFormatter = null;

      try {
        Class<? extends Formatter> formatterClass =
            (Class<? extends Formatter>)
                Minecraft.class
                    .getClassLoader()
                    .loadClass(
                        ModUtilities.getObfuscatedFieldName(
                            "net.minecraft.src.ConsoleLogFormatter", "em"));
        Constructor<? extends Formatter> defaultConstructor =
            formatterClass.getDeclaredConstructor();
        defaultConstructor.setAccessible(true);
        minecraftLogFormatter = defaultConstructor.newInstance();
      } catch (Exception ex) {
        ConsoleLogManager.init();
        minecraftLogFormatter = ConsoleLogManager.loggerLogManager.getHandlers()[0].getFormatter();
      }

      logger.setUseParentHandlers(false);

      StreamHandler consoleHandler = new ConsoleHandler();
      if (minecraftLogFormatter != null) consoleHandler.setFormatter(minecraftLogFormatter);
      logger.addHandler(consoleHandler);

      FileHandler logFileHandler =
          new FileHandler(
              new File(Minecraft.getMinecraftDir(), "LiteLoader.txt").getAbsolutePath());
      if (minecraftLogFormatter != null) logFileHandler.setFormatter(minecraftLogFormatter);
      logger.addHandler(logFileHandler);
    } catch (Throwable th) {
      logger.log(Level.SEVERE, "Error initialising LiteLoader", th);
      return false;
    }

    return true;
  }
Exemple #19
0
  public static FileHandler getIrcFileHandler() {
    createLogDir();
    try {
      FileHandler file = new FileHandler(LOG_FILE_IRC, MAX_LOG_SIZE, 2, true);
      file.setFormatter(
          new Formatter() {

            @Override
            public String format(LogRecord record) {
              return String.format(
                  "[%1$tT] %2$s\n", new Date(record.getMillis()), record.getMessage());
            }
          });
      file.setLevel(Level.INFO);
      return file;
    } catch (IOException | SecurityException ex) {
      Logger.getLogger(Logging.class.getName()).log(Level.WARNING, null, ex);
    }
    return null;
  }
  @Test(expected = IllegalArgumentException.class)
  public void
      getFileByParentDirectoryPathAndFolderNameAndFilenameShouldThrowIllegalArgumentExceptionWhenFilenameIsNull() {
    // Given

    // When
    fileHandler.getFileByParentDirectoryPathAndFolderNameAndFilename(
        FOLDER_NAME_PARENT, FOLDER_NAME_ACTUAL, null);

    // Then
  }
  public static void main(String[] args) {
    setJarLoc();

    new Console();

    System.out.println("Unzipping BTW");
    Boolean success = FileHandler.unzipBTW(jarLoc);
    if (success) {
      System.out.println("Applying Binary Pathces");
      BinaryPatcher.applyBinaryPatches(jarLoc);
      System.out.println("Copying Non BTW Edits");
      FileHandler.copyNonBTWEdits(jarLoc);
      System.out.println("Rezipping BTW");
      FileHandler.rezipBTW(jarLoc);
      System.out.println("Removing Temporary Directory");
      // FileHandler.removeTempDir(jarLoc);
      System.out.println("Done!");
    } else {
      System.out.println("Place your BTWModXXX.zip in the btw folder");
    }
  }
Exemple #22
0
  public void saveMap(File file) {

    if (_map != null)
      try {
        file.createNewFile();
        if (file.canWrite()) _fileHandler.saveData(file, _map);

      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
  }
  public void startGame(View view) {
    Toast.makeText(getApplicationContext(), "Listening for players", Toast.LENGTH_SHORT).show();
    // btnListenForPlayers.setClickable(false);

    String response = HttpHandler.startNewGame(maxplayers);
    // Split the response string and seperate it to playerID and gameID
    String data[] = response.split(":", 2);
    String playerID = data[0];
    String gameID = data[1];
    int gid = Integer.parseInt(gameID);
    Log.d(TAG, "PlayerID: " + playerID);
    FileHandler.savePlayerId(Integer.parseInt(playerID), this);
    Log.d(TAG, "GameID: " + gameID);
    FileHandler.saveGamestate(gameID + ":", this);

    Log.d(TAG, response);

    TextView twServerResponse = (TextView) findViewById(R.id.twServerResponce);
    twServerResponse.setText(response);

    startService(new Intent(this, RyscService.class));
  }
Exemple #24
0
  public DebugLog(String l, String f) {
    super(l, null);

    try {
      handler = new FileHandler(f, true);
      addHandler(handler);
      setLevel(Level.ALL);
      handler.setFormatter(formatter);
    } catch (Exception e) {
      System.out.println("Error creating logger '" + l + "': ");
      e.printStackTrace();
    }
  }
Exemple #25
0
  public void savePreferences(File file) {

    if (_preferences != null) {
      try {
        file.createNewFile();
        if (file.canWrite()) _fileHandler.saveData(file, _preferences);

      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
  }
Exemple #26
0
  public void importMap(File file) {

    if (file.exists() && file.canRead()) {

      _fileHandler.initImportData(file);

      _map = new Map();

      String line = _fileHandler.importData();

      while (line != null) {

        _preferences.importData(line, 0, null, null);
        _map.importData(line, 0, _preferences.getCellTypes(), _preferences.getColorEntities());
        line = _fileHandler.importData();
      }

      _fileHandler.closeImportFile();

      notifyNewMapLoaded();
    }
  }
  // Method to process the named entities
  public void processNamedEntity() {
    String serializedClassifier =
        "classifiers/english.all.3class.distsim.crf.ser.gz"; // 3 class (PERSON, LOCATION and
                                                             // ORGANISATION) classifier
    // String serializedClassifier = "classifiers/english.conll.4class.distsim.crf.ser.gz";
    AbstractSequenceClassifier<CoreLabel> classifier =
        CRFClassifier.getClassifierNoExceptions(serializedClassifier);
    FileHandler fw = new FileHandler();
    org.apache.log4j.PropertyConfigurator.configure(fw.filenameLog4JConfig);
    Path path = Paths.get(fw.filename); // path for input file

    try (BufferedReader reader = Files.newBufferedReader(path, Charset.defaultCharset())) {
      fw.setFile(fw.fileResultsWithNER); // delete contents to file before starting the process
      String line = null;
      while ((line = reader.readLine()) != null) {
        String classifiedData = classifier.classifyWithInlineXML(line);
        fw.writeToFile("", classifiedData, fw.fileResultsWithNER, true);
      }
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
Exemple #28
0
  private void initLogger() {
    ConsoleHandler consoleHandler = null;

    Logger rootLogger = LogManager.getLogManager().getLogger("");
    Handler[] handlers = rootLogger.getHandlers();
    for (Handler handler : handlers) {
      if (handler instanceof ConsoleHandler) {
        consoleHandler = (ConsoleHandler) handler;
        rootLogger.removeHandler(handler);
      }
    }

    logger = Logger.getLogger(contextId);
    logger.setLevel(logLevel);
    if (!logLevel.equals(Level.OFF)) {
      LogFormatter formatter = new LogFormatter();
      if (consoleLog) {
        if (consoleHandler == null) {
          consoleHandler = new ConsoleHandler();
        }
        consoleHandler.setFormatter(formatter);
        consoleHandler.setLevel(logLevel);
        logger.addHandler(consoleHandler);
      }
      String userHomePath = getProperty("user.home", ".");
      File logDir = new File(userHomePath, '.' + contextId + "/log");
      logDir.mkdirs();
      String logFilePattern = new File(logDir, contextId + "-%g.log").getPath();
      try {
        FileHandler fileHandler = new FileHandler(logFilePattern);
        fileHandler.setFormatter(formatter);
        fileHandler.setLevel(logLevel);
        logger.addHandler(fileHandler);
      } catch (IOException e) {
        System.err.println("Error: Failed to create log file: " + logFilePattern);
      }
    }
  }
  /** Constructor */
  public CraftyCdnClient() {

    // Load existing file content to memory.
    FileHandler.readVenuesFile();
    FileHandler.readAdsFile();
    FileHandler.readCraftSalesFile();
    FileHandler.readVendorsFile();
    FileHandler.readWebsiteFile();

    // initiate the gui
    gui = new CraftyCdnGUI();

    // get the content pane
    c = getContentPane();

    // set the content pane to border layout
    c.setLayout(new BorderLayout());

    // add the gui to the content pane
    c.add(gui, BorderLayout.CENTER);

    /** set JFrame parms & then pack */

    // set the window's title
    setTitle("Crafty Canadian Website Publisher");

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // pack the frame
    pack();

    // centre the JFrame on the centre of the desktop
    setLocationRelativeTo(null);

    // set the window to be visible
    setVisible(true);
  }
Exemple #30
0
 /**
  * Recurse into a directory handling cache files (*.bin) with the supplied {@link FileHandler}.
  *
  * @param dir
  * @param handler
  */
 private void handleDir(File dir, FileHandler handler) {
   if (dir.isDirectory()) {
     File[] files = dir.listFiles();
     for (File file : files) {
       if (file.isDirectory()) {
         handleDir(file, handler);
       } else {
         if (file.getName().endsWith(CACHE_FILE_EXT)) handler.handle(file);
       }
     }
   } else {
     throw new IllegalArgumentException(
         "handleDir() called with non-directory: " + dir.getAbsolutePath());
   }
 }