Class HadoopFileUtils


  • public class HadoopFileUtils
    extends java.lang.Object
    Utilities for file actions related to Hadoop.
    • Constructor Summary

      Constructors 
      Constructor Description
      HadoopFileUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.apache.hadoop.fs.Path createUniquePathInDir​(org.apache.hadoop.fs.FileSystem fileSystem, java.lang.String dir, java.util.UUID uuid)
      Creates and returns a unique path under a given directory.
      static void initDir​(org.apache.hadoop.fs.FileSystem fileSystem, java.lang.String hadoopDir)
      Initializes the given directory on the filesystem by deleting any existing file on the direct path and making all parent dirs in the directory path.
      static java.nio.file.Path makeLocalInputTempFile()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • createUniquePathInDir

        public static org.apache.hadoop.fs.Path createUniquePathInDir​(org.apache.hadoop.fs.FileSystem fileSystem,
                                                                      java.lang.String dir,
                                                                      java.util.UUID uuid)
        Creates and returns a unique path under a given directory.
        Parameters:
        fileSystem - The used filesystem
        dir - A path to the parent directory to create the Path under
        uuid - The UUID used to name the Path
        Returns:
        A Hadoop path representing a unique file/directory or null if an error is encountered
      • initDir

        public static void initDir​(org.apache.hadoop.fs.FileSystem fileSystem,
                                   java.lang.String hadoopDir)
                            throws java.io.IOException
        Initializes the given directory on the filesystem by deleting any existing file on the direct path and making all parent dirs in the directory path.
        Parameters:
        fileSystem - The filesystem on which the actions are executed.
        hadoopDir - The directory path to initialize.
        Throws:
        java.io.IOException - If any action on the filesystem fails.