public static Path getUniqueFile(final FileSystem fs, final Path dir) throws IOException {
    if (!fs.getFileStatus(dir).isDirectory()) {
      throw new IOException("Expecting " + dir.toString() + " to be a directory");
    }
    return new Path(dir, dash.matcher(UUID.randomUUID().toString()).replaceAll(""));
  }
@param dir Directory to create file in.
@return random filename inside passed <code>dir</code>
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileWriter.java