code for handling files (IndexFileHandler.java)