/** * Returns true if the specified file has a valid HFile Trailer. * @param fs filesystem * @param path Path to file to verify * @return true if the file has a valid HFile Trailer, otherwise false * @throws IOException if failed to read from the underlying stream */ public static boolean isHFileFormat(final FileSystem fs, final Path path) throws IOException { return isHFileFormat(fs, fs.getFileStatus(path)); }
private List<Path> getFilesRecursively(String fileBackupDir) throws IllegalArgumentException, IOException { FileSystem fs = FileSystem.get((new Path(fileBackupDir)).toUri(), new Configuration()); List<Path> list = new ArrayList<>(); RemoteIterator<LocatedFileStatus> it = fs.listFiles(new Path(fileBackupDir), true); while (it.hasNext()) { Path p = it.next().getPath(); if (HFile.isHFileFormat(fs, p)) { list.add(p); } } return list; }
if (!HFile.isHFileFormat(fs, hfile)) { LOG.warn("the file " + hfile + " doesn't seems to be an hfile. skipping"); continue;
/** * Returns true if the specified file has a valid HFile Trailer. * @param fs filesystem * @param path Path to file to verify * @return true if the file has a valid HFile Trailer, otherwise false * @throws IOException if failed to read from the underlying stream */ public static boolean isHFileFormat(final FileSystem fs, final Path path) throws IOException { return isHFileFormat(fs, fs.getFileStatus(path)); }
if (!HFile.isHFileFormat(fs, hfile)) { LOG.warn("the file " + hfile + " doesn't seems to be an hfile. skipping"); continue;