net.sourceforge.jpotpourri.util
Class FileUtil

java.lang.Object
  extended by net.sourceforge.jpotpourri.util.FileUtil

public class FileUtil
extends java.lang.Object

Author:
christoph_pickl@users.sourceforge.net

Constructor Summary
protected FileUtil()
           
 
Method Summary
static java.io.File copyDirectoryRecursive(java.io.File sourceDir, java.io.File targetSuperDir)
           
static void copyFile(java.io.File sourceFile, java.io.File targetFile)
           
static void deleteDirectoryRecursive(java.io.File directory)
           
static java.lang.String extractExtension(java.io.File file)
           
static java.lang.String extractExtension(java.lang.String fileName)
           
static java.lang.String extractLastFolderName(java.lang.String path)
           
static java.lang.String formatFileSize(long inKiloByte)
           
static java.lang.String formatFileSizeGb(long inKiloByte)
           
static java.lang.String getFileContent(java.io.File file)
           
static java.lang.String getFileContent(java.lang.String absoluteAbsolutePath)
           
static java.lang.String getFileContentsFromJar(java.lang.String jarFile, int initialCapacityOfStringBuilder)
           
static double getGigaByteFromKiloByte(long kb)
           
static java.io.File getParentByPath(java.io.File file)
           
static long getSizeRecursive(java.io.File file)
           
static boolean isHiddenFile(java.io.File file)
           
static void main(java.lang.String[] args)
           
static void writeFileContent(java.io.File file, java.lang.String content)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtil

protected FileUtil()
Method Detail

extractExtension

public static java.lang.String extractExtension(java.io.File file)
Returns:
null if no extension; otherwise lowercase suffix behind last "."

extractExtension

public static java.lang.String extractExtension(java.lang.String fileName)
Returns:
null if no extension; otherwise lowercase suffix behind last "."

copyFile

public static void copyFile(java.io.File sourceFile,
                            java.io.File targetFile)
                     throws FileUtilException
Throws:
FileUtilException

copyDirectoryRecursive

public static java.io.File copyDirectoryRecursive(java.io.File sourceDir,
                                                  java.io.File targetSuperDir)
                                           throws FileUtilException
Throws:
FileUtilException

formatFileSize

public static java.lang.String formatFileSize(long inKiloByte)
Returns:
something like "13.3 KB" or "3.1 GB"

formatFileSizeGb

public static java.lang.String formatFileSizeGb(long inKiloByte)

getGigaByteFromKiloByte

public static double getGigaByteFromKiloByte(long kb)

deleteDirectoryRecursive

public static void deleteDirectoryRecursive(java.io.File directory)
                                     throws FileUtilException
Throws:
FileUtilException

isHiddenFile

public static boolean isHiddenFile(java.io.File file)

getFileContentsFromJar

public static java.lang.String getFileContentsFromJar(java.lang.String jarFile,
                                                      int initialCapacityOfStringBuilder)
                                               throws FileUtilException
Throws:
FileUtilException

extractLastFolderName

public static java.lang.String extractLastFolderName(java.lang.String path)

getSizeRecursive

public static long getSizeRecursive(java.io.File file)

getParentByPath

public static java.io.File getParentByPath(java.io.File file)

writeFileContent

public static void writeFileContent(java.io.File file,
                                    java.lang.String content)
                             throws java.io.IOException
Throws:
java.io.IOException

getFileContent

public static java.lang.String getFileContent(java.io.File file)
                                       throws java.io.IOException
Throws:
java.io.IOException

getFileContent

public static java.lang.String getFileContent(java.lang.String absoluteAbsolutePath)
                                       throws java.io.IOException
Throws:
java.io.IOException

main

public static void main(java.lang.String[] args)


Copyright © 2008. All Rights Reserved.