private void overrideStorageEntryWithNewValue(String oldValue, String newValue) throws IOException { String newText = constructNewEntryText(oldValue, newValue); OutputStream storageOutputStream = storage.toPropertiesFile().getOutputStream(); storageOutputStream.write(newText.getBytes("ISO-8859-1")); storageOutputStream.close(); }
private void deleteStorageEntry(String key) throws IOException { String currentText = storage.toPropertiesFile().asText(); int index = currentText.indexOf(key); String before = currentText.substring(0, index); String after = currentText.substring(index + key.length() + 1); String newText = before.concat(after); OutputStream storageOutputStream = storage.toPropertiesFile().getOutputStream(); storageOutputStream.write(newText.getBytes("ISO-8859-1")); storageOutputStream.close(); }
private void overrideStorageEntryWithNewData(String newData) throws IOException { OutputStream storageOutputStream = storage.toPropertiesFile(true).getOutputStream(); storageOutputStream.write(newData.getBytes("ISO-8859-1")); storageOutputStream.close(); }