|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.emf.test.build.FileTool
public class FileTool
A tool for performing operations on files.
Nested Class Summary | |
---|---|
static interface |
FileTool.IZipFilter
A zip filter which is used to filter out unwanted entries while extracting a zip file. |
Constructor Summary | |
---|---|
FileTool()
|
Method Summary | |
---|---|
static java.lang.String |
changeSeparator(java.lang.String path,
char oldSeparator,
char newSeparator)
Returns the given file path with its separator character changed from the given old separator to the given new separator. |
static boolean |
compare(java.io.File file1,
java.io.File file2)
Returns a boolean indicating whether the given files have the same content. |
static void |
copy(java.io.File src,
java.io.File dst)
Copies the given source file to the given destination file. |
static void |
copy(java.io.File root,
java.io.File src,
java.io.File dst)
Copies the given source file to the given destination file. |
static void |
delete(java.io.File file)
Delete the given file or directory. |
static java.io.File |
getFile(java.lang.String[] segments)
Returns a new File from the given path name segments. |
static java.io.File[] |
getFiles(java.io.File dir,
java.lang.String[] include,
java.lang.String[] exclude)
Returns a list of all files below the given directory that end with a string in the given include list and do not end with a string in the given exclude list. |
static java.lang.String[] |
getSegments(java.io.File file)
Breaks the given file into its path name segments and returns the result. |
static java.lang.String[] |
getSegments(java.lang.String s,
char separator)
Breaks the given string into segments and returns the result. |
static java.io.File[] |
parsePaths(java.lang.String paths)
Returns a vector of File paths parsed from the given
paths string. |
static void |
transferData(java.io.File source,
java.io.File destination)
Copies all bytes in the given source file to the given destination file. |
static void |
transferData(java.io.InputStream source,
java.io.OutputStream destination)
Copies all bytes in the given source stream to the given destination stream. |
static void |
unzip(FileTool.IZipFilter filter,
java.util.zip.ZipFile zipFile,
java.io.File dstDir)
Unzips the given zip file to the given destination directory extracting only those entries the pass through the given filter. |
static void |
zip(java.io.File dir,
java.io.File zipFile)
Zips the given directory to the given zip file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileTool()
Method Detail |
---|
public static java.lang.String changeSeparator(java.lang.String path, char oldSeparator, char newSeparator)
path
- a file patholdSeparator
- a path separator characternewSeparator
- a path separator character
public static boolean compare(java.io.File file1, java.io.File file2) throws java.io.IOException
file1
- the first filefile2
- the second file
java.io.IOException
public static void copy(java.io.File src, java.io.File dst) throws java.io.IOException
src
- the given source filedst
- the given destination file
java.io.IOException
public static void copy(java.io.File root, java.io.File src, java.io.File dst) throws java.io.IOException
root
- src
- the given source filedst
- the given destination file
java.io.IOException
public static void delete(java.io.File file)
file
- a file or directorypublic static java.io.File getFile(java.lang.String[] segments)
File
from the given path name segments.
segments
- the given path name segments
File
from the given path name segmentspublic static java.io.File[] getFiles(java.io.File dir, java.lang.String[] include, java.lang.String[] exclude)
null
all files are
included except those that are explicitly excluded. If exclude is null
no files are excluded except those that are not included.
dir
- the given directoryinclude
- a list of filenames to includeexclude
- a list of filenames to exclude
public static java.lang.String[] getSegments(java.io.File file)
file
- a file or directory
public static java.lang.String[] getSegments(java.lang.String s, char separator)
s
- a stringseparator
- the segment separator
public static java.io.File[] parsePaths(java.lang.String paths)
File
paths parsed from the given
paths string.
paths
- a paths string
File
paths parsed from the given
paths stringpublic static void transferData(java.io.File source, java.io.File destination) throws java.io.IOException
source
- the given source filedestination
- the given destination file
java.io.IOException
public static void transferData(java.io.InputStream source, java.io.OutputStream destination) throws java.io.IOException
source
- the given source streamdestination
- the given destination stream
java.io.IOException
public static void unzip(FileTool.IZipFilter filter, java.util.zip.ZipFile zipFile, java.io.File dstDir) throws java.io.IOException
filter
- filters out unwanted zip entrieszipFile
- the zip file to unzipdstDir
- the destination directory
java.io.IOException
public static void zip(java.io.File dir, java.io.File zipFile) throws java.io.IOException
dir
- the directory to zipzipFile
- the resulting zip file
java.io.IOException
|
Copyright 2001-2006 IBM Corporation and others. All Rights Reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |