Ejemplo n.º 1
0
 /**
  * Put a datum with a position and string key, overwriting as necessary.
  *
  * @param pos The position portion of the key.
  * @param key The string key.
  * @param data The data to put.
  */
 public void putPositionDatum(NodePosition pos, String key, String data) {
   byte[] keyBytes =
       ArrayUtils.addAll(
           bytes("npos::"), // $NON-NLS-1$
           ArrayUtils.addAll(pos.toBytes(), bytes("str::" + key))); // $NON-NLS-1$
   byte[] dataBytes = bytes(data);
   this.innerDb.put(keyBytes, dataBytes);
 }
Ejemplo n.º 2
0
 /**
  * Get a piece of string data with a position and string key, or <code>null</code> if the datum
  * cannot be found. Position keys are exclusive from all other key types.
  *
  * @param key
  * @return The found data.
  */
 public String getPositionDatum(NodePosition pos, String key) {
   byte[] keyBytes =
       ArrayUtils.addAll(
           bytes("npos::"), // $NON-NLS-1$
           ArrayUtils.addAll(pos.toBytes(), bytes("str::" + key))); // $NON-NLS-1$
   byte[] dataBytes = this.innerDb.get(keyBytes);
   return (dataBytes == null) ? null : asString(dataBytes);
 }