コード例 #1
0
 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();
 }
コード例 #2
0
  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();
  }
コード例 #3
0
 private void overrideStorageEntryWithNewData(String newData) throws IOException {
   OutputStream storageOutputStream = storage.toPropertiesFile(true).getOutputStream();
   storageOutputStream.write(newData.getBytes("ISO-8859-1"));
   storageOutputStream.close();
 }