コード例 #1
0
 /**
  * Puts a string of data keyed with a string and chunk.
  *
  * @param pos The chunk position.
  * @param key The string key.
  * @param data The data to put.
  */
 public void putChunkDatum(Position pos, String key, String data) {
   byte[] keyBytes =
       ArrayUtils.addAll(
           bytes("cpos::"), // $NON-NLS-1$
           ArrayUtils.addAll(pos.toBytes(), bytes("str::" + key))); // $NON-NLS-1$
   byte[] dataBytes = bytes(data);
   this.innerDb.put(keyBytes, dataBytes);
 }
コード例 #2
0
 /**
  * Gets a string of data associated with a chunk and string key, or <code>null</code> if not
  * found.
  *
  * @param pos The chunk position.
  * @param key The string key.
  * @return The found data.
  */
 public String getChunkDatum(Position pos, String key) {
   byte[] keyBytes =
       ArrayUtils.addAll(
           bytes("cpos::"), // $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);
 }