public int addValue(String key, String value) {
        if (keyPointers.containsKey(key)){
            System.out.println("This key is already exist");
            return 1;
        }

        RandomAccessFile data;
        PrintWriter pointers;
        long dataPosition = getPosition(value.length());
        try {
            data = new RandomAccessFile(dataStorage, "rw");
            pointers = new PrintWriter(new FileWriter(pointerStorage, true));
            data.seek(dataPosition);
            value += ";";
            data.write(value.getBytes());
            pointers.append(key + "-" + dataPosition + ";");
            keyPointers.put(key, dataPosition);
            data.close();
            pointers.close();
        } catch (FileNotFoundException notFound) {
            //System.out.println("Can't open data storage or pointers storage");
            return 2;
            //return false;
        } catch (IOException io) {
            return 2;
            //System.out.println("Writing error");
            //return false;
        }
        freePointers.remove(dataPosition);
        rewriteFreeSpace();

        ++amount;
        System.out.println("Amount: " + amount);
        return 0;
        //return true;
    }