/** * Search for the record identified by queryKey. Uses a linear search from * the beginning of the file. * * @param queryKey * @return the found value, or null. */ public V find(K queryKey) { return find(queryKey, 0); }
/** * Search for the record identified by queryKey. Uses a linear search from * the beginning of the file. * * @param queryKey * @return the found value, or null. */ public V find(K queryKey) { return find(queryKey, 0); }
/** * Find a record and write the value to a file. * * @param key * @param fs * @param dirPath * @param offset * @return false if record not found, true otherwise. * @throws IOException */ public boolean findAndExport(K key, FileSystem fs, Path dirPath, long offset) throws IOException { final V value = find(key, offset); if (value == null) return false; if (fs != null && fs != null) { final Path outFilePath = new Path(dirPath, key.toString()); writeFile(fs, outFilePath, value); } else { printFile(value); } return true; }
/** * Find a record and write the value to a file. * * @param key * @param fs * @param dirPath * @param offset * @return false if record not found, true otherwise. * @throws IOException */ public boolean findAndExport(K key, FileSystem fs, Path dirPath, long offset) throws IOException { final V value = find(key, offset); if (value == null) return false; if (fs != null && fs != null) { final Path outFilePath = new Path(dirPath, key.toString()); writeFile(fs, outFilePath, value); } else { printFile(value); } return true; }