public int deleteValue(String key) throws IOException {
        if (!keyPointers.containsKey(key))
            return 3;
        long position = keyPointers.get(key);
        int size = 0;
        RandomAccessFile data = new RandomAccessFile(dataStorage, "rw");
        data.seek(position);
        char c;
        while((c = (char)data.readByte()) != ';'){
            ++size;
        }
        PrintWriter free = null;
        try {
            free = new PrintWriter(new FileWriter(freeSpace, true));
            free.append(position + "-" + size + ";");
        } catch (Exception e) {
            return 2;
        }
        finally {
            free.close();
            data.close();
        }
        freePointers.put(position, size);
        keyPointers.remove(key);
        if (!rewriteKeys()){
            return 2;
        }
        --amount;
        System.out.println("Amount: " + amount);
        return 0;
    }