|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.jpkgmk.util.FileUtil
public class FileUtil
Field Summary | |
---|---|
static java.lang.String |
UNIX_FILE_SEPARATOR
|
Method Summary | |
---|---|
static void |
assertContainsFiles(java.io.File dirToCheck,
java.io.File[] expectedFiles)
Non-recursively checks the content of the given directory against the given array of file objects. |
static java.lang.String |
buildPath(java.io.File fileOrDir,
java.lang.String pathSeparator)
Builds a path and separates the given file or directory using the given pathSeparator. |
static void |
copyFile(java.io.File sourceFile,
java.io.File destFile)
Copies one file to a different location |
static void |
copyFiles(java.io.File sourceDir,
java.io.File targetDir,
java.io.FileFilter fileFilter)
Recursively copies the source directory with all files to the target directory. |
static int |
countFiles(java.io.File directory)
Recursively counts the files in the given directory. |
static int |
countFiles(java.io.File directory,
boolean countDirectories)
Recursively counts the files in the given directory. |
static int |
countFilesAndDirectories(java.io.File directory)
Recursively counts the files in the given directory. |
static void |
createDir(java.io.File dir,
boolean failOnError)
|
static java.io.File |
createGzip(java.io.File inputFile)
Creates a ".gz" file of the given input file. |
static void |
createTar(java.io.File directoryToPack,
java.io.File targetTarFile)
Creates a tar file of all files in the given directory. |
static void |
deleteRecursively(java.io.File fileOrDirectory)
|
static java.lang.Long |
getBlockCount(java.io.File basedir)
Returns the number of 512 byte blocks that are needed to store the given directory. |
static java.util.List<java.io.File> |
getFiles(java.io.File destDir,
java.io.FileFilter filter)
Returns all files and directories from the given dir recursively |
static long |
getSize(java.io.File basedir)
|
static boolean |
isRelocatable(java.lang.String path)
Determines if the given unix path is a relocatable path or not in the sense of a prototype file. |
static boolean |
isSubdir(java.io.File subDirToCheck,
java.io.File basedir)
|
static java.lang.String |
readFile(java.io.File file)
|
static java.lang.String |
readString(java.io.InputStream input)
Reads the bytes from the given input stream using the default platform character set. |
static java.lang.String |
readString(java.io.InputStream input,
java.nio.charset.Charset charset)
Reads the string from the given input stream using the given charset. |
static java.lang.String |
readString(java.net.URL file)
|
static void |
writeFile(java.io.File target,
java.lang.String content)
|
static void |
writeFile(java.io.File target,
java.lang.String content,
java.nio.charset.Charset charset)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String UNIX_FILE_SEPARATOR
Method Detail |
---|
public static java.io.File createGzip(java.io.File inputFile)
inputFile
-
public static void createTar(java.io.File directoryToPack, java.io.File targetTarFile) throws java.io.IOException
directoryToPack
- The directory to be packedtargetTarFile
- The target file for storing the new tar
java.io.IOException
public static void deleteRecursively(java.io.File fileOrDirectory)
public static void writeFile(java.io.File target, java.lang.String content) throws java.io.IOException
java.io.IOException
public static void writeFile(java.io.File target, java.lang.String content, java.nio.charset.Charset charset) throws java.io.IOException
java.io.IOException
public static java.lang.String readFile(java.io.File file) throws java.io.IOException
java.io.IOException
public static java.lang.String readString(java.net.URL file) throws java.io.IOException
java.io.IOException
public static java.lang.String readString(java.io.InputStream input) throws java.io.IOException
readString(InputStream, Charset)
to
ensure that the character conversion is correctly done.
input
-
java.io.IOException
public static java.lang.String readString(java.io.InputStream input, java.nio.charset.Charset charset) throws java.io.IOException
input
- charset
-
java.io.IOException
public static boolean isSubdir(java.io.File subDirToCheck, java.io.File basedir)
public static java.lang.String buildPath(java.io.File fileOrDir, java.lang.String pathSeparator)
fileOrDir
- pathSeparator
-
public static java.util.List<java.io.File> getFiles(java.io.File destDir, java.io.FileFilter filter)
destDir
- filter
-
public static void copyFiles(java.io.File sourceDir, java.io.File targetDir, java.io.FileFilter fileFilter) throws java.io.IOException
sourceDir
- targetDir
- fileFilter
- File filter used for copying. Can be null which will include all files to the copy process.
java.io.IOException
public static void copyFile(java.io.File sourceFile, java.io.File destFile) throws java.io.IOException
sourceFile
- destFile
- The destination file
java.io.IOException
public static void createDir(java.io.File dir, boolean failOnError)
public static boolean isRelocatable(java.lang.String path)
path
- The path to check.
public static int countFilesAndDirectories(java.io.File directory)
directory
-
public static int countFiles(java.io.File directory)
directory
-
public static int countFiles(java.io.File directory, boolean countDirectories)
directory
- countDirectories
- If subdirectories should also be included into the count
public static java.lang.Long getBlockCount(java.io.File basedir)
basedir
-
public static long getSize(java.io.File basedir)
basedir
-
public static void assertContainsFiles(java.io.File dirToCheck, java.io.File[] expectedFiles)
dirToCheck
- expectedFiles
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |