Пример #1
0
 private boolean checkKey(String key) {
   if (key == null) {
     throw new IllegalArgumentException("checkKey: key == null");
   }
   try {
     return ((folderFileIndexes.getFolderIndex()
             == Math.abs(
                 key.getBytes(TableManager.CODE_FORMAT)[0] % TableManager.NUMBER_OF_PARTITIONS)
         && folderFileIndexes.getFileIndex()
             == Math.abs(
                 (key.getBytes(TableManager.CODE_FORMAT)[0] / TableManager.NUMBER_OF_PARTITIONS)
                     % TableManager.NUMBER_OF_PARTITIONS)));
   } catch (UnsupportedEncodingException e) {
     return false;
   }
 }
Пример #2
0
 private Path makeAbsolutePath(Path tablePath, Coordinates folderFileIndexes) {
   return tablePath.resolve(
       Paths.get(
           Integer.toString(folderFileIndexes.getFolderIndex()) + ".dir",
           Integer.toString(folderFileIndexes.getFileIndex()) + ".dat"));
 }