|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.mylar.monitor.reports.tests.FileTool
public class FileTool
Provides access to files for testing. TODO: Copied from the bugzilla component - consider refactoring as common utility
Field Summary | |
---|---|
private static byte[] |
buffer
A buffer. |
private static int |
MAX_RETRY
|
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 void |
copy(java.io.File src,
java.io.File dst)
Copies the given source file to the given destination file. |
static java.io.File |
createTempFileInPlugin(org.eclipse.core.runtime.Plugin plugin,
org.eclipse.core.runtime.IPath path)
|
static void |
delete(java.io.File file)
|
static java.io.File |
getFileInPlugin(org.eclipse.core.runtime.Plugin plugin,
org.eclipse.core.runtime.IPath path)
|
static java.lang.StringBuffer |
read(java.io.Reader reader)
|
static java.lang.StringBuffer |
read(java.lang.String fileName)
|
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(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. |
private static void |
unzip(java.util.zip.ZipFile zipFile,
java.io.File rootDstDir,
java.io.File dstDir,
int depth)
|
static void |
write(java.lang.String fileName,
java.lang.StringBuffer content)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int MAX_RETRY
private static byte[] buffer
Constructor Detail |
---|
public FileTool()
Method Detail |
---|
public static void unzip(java.util.zip.ZipFile zipFile, java.io.File dstDir) throws java.io.IOException
zipFile
- the zip file to unzipdstDir
- the destination directory
java.io.IOException
- in case of problemprivate static void unzip(java.util.zip.ZipFile zipFile, java.io.File rootDstDir, java.io.File dstDir, int depth) throws java.io.IOException
java.io.IOException
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 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
- in case of errorpublic 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
- in case of errorpublic 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
- in case of errorpublic static java.io.File getFileInPlugin(org.eclipse.core.runtime.Plugin plugin, org.eclipse.core.runtime.IPath path)
public static java.io.File createTempFileInPlugin(org.eclipse.core.runtime.Plugin plugin, org.eclipse.core.runtime.IPath path)
public static java.lang.StringBuffer read(java.lang.String fileName) throws java.io.IOException
java.io.IOException
public static java.lang.StringBuffer read(java.io.Reader reader) throws java.io.IOException
java.io.IOException
public static void write(java.lang.String fileName, java.lang.StringBuffer content) throws java.io.IOException
java.io.IOException
public static void delete(java.io.File file)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |