insert values into root node

This commit is contained in:
2018-10-14 19:53:02 +02:00
parent 3855d03ead
commit bb4514c940
2 changed files with 15 additions and 9 deletions

View File

@@ -35,8 +35,9 @@ public class PersistentMap {
}
}
public void put(final String key, final long value) throws IOException {
put(key.getBytes(UTF8), VariableByteEncoder.encode(value));
public Long put(final String key, final long value) throws IOException {
final byte[] oldValue = put(key.getBytes(UTF8), VariableByteEncoder.encode(value));
return oldValue == null ? null : VariableByteEncoder.decodeFirstValue(oldValue);
}
public long getAsLong(final String key) throws IOException {
@@ -44,8 +45,9 @@ public class PersistentMap {
return buffer == null ? null : VariableByteEncoder.decodeFirstValue(buffer);
}
public void put(final String key, final String value) throws IOException {
put(key.getBytes(UTF8), value.getBytes(UTF8));
public String put(final String key, final String value) throws IOException {
final byte[] oldValue = put(key.getBytes(UTF8), value.getBytes(UTF8));
return oldValue == null ? null : new String(oldValue, UTF8);
}
public String getAsString(final String key) throws IOException {