public LinkCache(String directory) throws IOException {
        if (directory == null) {
            throw new IllegalArgumentException("directory is null.");
        }

       File file =  new File(directory);
       if (!(file.exists() && file.isDirectory() && file.canWrite() && file.canRead())) {
           throw new IOException("Directory must exist and have read and write access.");
       }
       mDirectory = file;
    }