org.unigram.likelike.common
Class FsUtil

java.lang.Object
  extended by org.unigram.likelike.common.FsUtil

public final class FsUtil
extends java.lang.Object

File utility class.


Method Summary
static boolean checkPath(org.apache.hadoop.fs.Path dir, org.apache.hadoop.conf.Configuration conf)
          Check a file or directory exist.
static boolean checkPath(org.apache.hadoop.fs.Path dir, org.apache.hadoop.fs.FileSystem fs)
          Check a file or directory exist.
static void clean(org.apache.hadoop.fs.FileSystem fs, java.lang.String... fileNames)
          Delete files.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

checkPath

public static boolean checkPath(org.apache.hadoop.fs.Path dir,
                                org.apache.hadoop.fs.FileSystem fs)
                         throws java.io.IOException
Check a file or directory exist. if so delete them.

Parameters:
dir - path to be checked
fs - filesystem containing the path
Returns:
true when the check succeeded
Throws:
java.io.IOException - occurs deleting file

checkPath

public static boolean checkPath(org.apache.hadoop.fs.Path dir,
                                org.apache.hadoop.conf.Configuration conf)
                         throws java.io.IOException
Check a file or directory exist. if so delete them.

Parameters:
dir - dir path to be checked
conf - containing the filesystem of path
Returns:
true when the check succeeded
Throws:
java.io.IOException - when opening error such as there is no directory.

clean

public static void clean(org.apache.hadoop.fs.FileSystem fs,
                         java.lang.String... fileNames)
                  throws java.io.IOException
Delete files.

Parameters:
fs - filesytem containing files with fileNames
fileNames - file names to be removed
Throws:
java.io.IOException - -