de.cau.cs.kieler.kex.controller.util
Class IOHandler

java.lang.Object
  extended by de.cau.cs.kieler.kex.controller.util.IOHandler

public final class IOHandler
extends Object

This class provides all methods to access I/O.

Rating red

Field Summary
static String MANIFEST_MF
          The variable holds manifest_mf filename.
static String PLUGIN_XML
          The variable holds plugin.xml filename.
static String PROJECT_FILE
          The variable holds project filename.
 
Method Summary
static void createFolder(String destFolder)
          creates a folder with given parameter.
static boolean deleteFile(File deletable)
          deletes a file or a directory.
static File filterPluginProject(File location)
          searches for a java project, therefore the ".project" file is searched.
static File filterPluginXML(File location)
          filters the plugin.xml of plugin project for given destination.
Searches first for a java project by checking parent dirs for containing ".project" file.
static File searchUP(File sourceDir, String fileName)
          Searches for an file with matching fileName in parent folders of source directory.
static void writeFile(URL sourceUrl, String destPath, boolean checkDuplicate)
           
static void writeResource(File sourceFile, File destFile)
          writes the resource from sourceFile to destFile.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROJECT_FILE

public static final String PROJECT_FILE
The variable holds project filename.

See Also:
Constant Field Values

MANIFEST_MF

public static final String MANIFEST_MF
The variable holds manifest_mf filename.

See Also:
Constant Field Values

PLUGIN_XML

public static final String PLUGIN_XML
The variable holds plugin.xml filename.

See Also:
Constant Field Values
Method Detail

writeResource

public static void writeResource(File sourceFile,
                                 File destFile)
                          throws IOException
writes the resource from sourceFile to destFile.

Parameters:
sourceFile - , File
destFile - , File
Throws:
IOException - , if sourcefile not exists.

deleteFile

public static boolean deleteFile(File deletable)
deletes a file or a directory. If a directory is choosen, all subdirectories and files will be deleted.

Parameters:
deletable - , File
Returns:
true, if deleting success, otherwise false.

filterPluginProject

public static File filterPluginProject(File location)
searches for a java project, therefore the ".project" file is searched.

Parameters:
location - , File into a plugin project.
Returns:
File, plugin project

filterPluginXML

public static File filterPluginXML(File location)
filters the plugin.xml of plugin project for given destination.
Searches first for a java project by checking parent dirs for containing ".project" file.
Searches than in found project for "manifest.mf" file of an plugin project and if that found, finally searches the plugin.xml.

Parameters:
location - , folder in an plugin project.
Returns:
plugin.xml if found otherwise parent java project directory

searchUP

public static File searchUP(File sourceDir,
                            String fileName)
Searches for an file with matching fileName in parent folders of source directory.

Parameters:
sourceDir - , File
fileName - , String
Returns:
File, if exactly one file is found otherwise null;

writeFile

public static void writeFile(URL sourceUrl,
                             String destPath,
                             boolean checkDuplicate)
                      throws IOException
Parameters:
sourceUrl - , source URL
destPath - , destination path as String
checkDuplicate - , boolean
Throws:
IOException - , can occur while io writing.

createFolder

public static void createFolder(String destFolder)
creates a folder with given parameter.

Parameters:
destFolder - , pathname of destination folder.