org.openmobileis.common.util.file
Class FileUtilities

java.lang.Object
  extended byorg.openmobileis.common.util.file.FileUtilities

public class FileUtilities
extends java.lang.Object

contains various utilities method related to file use.


Constructor Summary
FileUtilities()
           
 
Method Summary
static java.lang.String convertFileNameToSystem(java.lang.String zipFile)
          replace all nom system file separator by system file separator use for windows system to convert zip file name to windews file name
static java.lang.String convertToUnixFomat(java.lang.String filePath)
           
static void copyFile(java.lang.String sourcePath, java.lang.String destPath)
           
static java.lang.String getNameFromCompleteFileName(java.lang.String completeName)
          return the name of the file extracted from the specified complete file name.
static java.lang.String getPathFromCompleteFileName(java.lang.String completeName)
          return the path extracted from the specified complete file name.
static void moveFile(java.lang.String oldFileName, java.lang.String newFileName)
          move file from old name to new name.
static byte[] readFile(java.io.File file)
           
static byte[] readFile(java.lang.String completeFileName)
           
static void removeAllFile(java.io.File file, java.lang.String ext, boolean recurcif)
          remove all file with the specified ext starting at file directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtilities

public FileUtilities()
Method Detail

convertFileNameToSystem

public static java.lang.String convertFileNameToSystem(java.lang.String zipFile)
replace all nom system file separator by system file separator use for windows system to convert zip file name to windews file name


getPathFromCompleteFileName

public static java.lang.String getPathFromCompleteFileName(java.lang.String completeName)
return the path extracted from the specified complete file name. The completeFileName must be conforme to the system file name (path+separator+fileName). Path end with the System separator. If not path is specified return empty string.


getNameFromCompleteFileName

public static java.lang.String getNameFromCompleteFileName(java.lang.String completeName)
return the name of the file extracted from the specified complete file name. The completeFileName must be conforme to the system file name (path+SystemSeparator+fileName). if the file has not path return the CompleteFileName if the CompleteFileName has no fileName return empty string.


moveFile

public static void moveFile(java.lang.String oldFileName,
                            java.lang.String newFileName)
move file from old name to new name. If new fileExist delete it before move


convertToUnixFomat

public static java.lang.String convertToUnixFomat(java.lang.String filePath)

readFile

public static byte[] readFile(java.lang.String completeFileName)
                       throws java.io.FileNotFoundException,
                              java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

readFile

public static byte[] readFile(java.io.File file)
                       throws java.io.FileNotFoundException,
                              java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

removeAllFile

public static final void removeAllFile(java.io.File file,
                                       java.lang.String ext,
                                       boolean recurcif)
remove all file with the specified ext starting at file directory. If recursif is true remove inside sub directory. if ext is null, remove all file.


copyFile

public static final void copyFile(java.lang.String sourcePath,
                                  java.lang.String destPath)
                           throws java.io.FileNotFoundException,
                                  java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException


Copyright 2006 OpenMobileIS. All Rights Reserved.