tico.editor
Class TFileHandler

java.lang.Object
  extended by tico.editor.TFileHandler

public class TFileHandler
extends java.lang.Object

Static class that manages the current editing project internal files.

Version:
1.0 Nov 20, 2006
Author:
Pablo Muñoz

Constructor Summary
TFileHandler()
           
 
Method Summary
static void cleanCurrentDirectory()
          Deletes all the current directory contents.
static java.lang.String convertToAbsolute(java.lang.String path)
          Converts the specified internal file partial path to an absolute path adding the current directory path.
static java.lang.String convertToPartial(java.io.File file)
          Converts the specified internal file absolute path to a current directory partial path.
static java.lang.String convertToPartial(java.lang.String path)
          Converts the specified internal file absolute path to a current directory partial path.
static void copyFile(java.io.File in, java.io.File out)
          Copies the content of an in file to an out file.
static void deleteCurrentDirectory()
          Deletes the current directory and all its contents.
static void deleteDirectory(java.io.File directory)
          Deletes the specified directory and all its contents.
static java.io.File getCurrentDirectory()
          Returns the editor internal currentDirectory.
static java.lang.String getCurrentDirectoryPath()
          Returns the editor internal currentDirectoryPath.
static java.lang.String getExtension(java.lang.String filePath)
           
static java.lang.String getFilename(java.lang.String filePath)
           
static java.io.File importFile(java.io.File file)
          Imports the specified file to the internal application structure.
static java.io.File importFile(java.lang.String fileAbsolutePath)
          Imports the specified file to the internal application structure.
static void remove(java.lang.String fileAbsolutePath)
          Removes the specified file from the internal application structure.
static java.lang.String removeDirectoryPath(java.lang.String directory, java.lang.String path)
          Removes the specified directory from the specified path.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TFileHandler

public TFileHandler()
Method Detail

importFile

public static java.io.File importFile(java.lang.String fileAbsolutePath)
                               throws java.io.IOException
Imports the specified file to the internal application structure.

Parameters:
fileAbsolutePath - The specified file fileAbsolutePath
Returns:
The new internal file
Throws:
java.io.IOException - If there is any problem importing the file

importFile

public static java.io.File importFile(java.io.File file)
                               throws java.io.IOException
Imports the specified file to the internal application structure.

Parameters:
file - The specified file
Returns:
The new internal file
Throws:
java.io.IOException - If there is any problem importing the file

remove

public static void remove(java.lang.String fileAbsolutePath)
Removes the specified file from the internal application structure.

Parameters:
fileAbsolutePath - The specified file fileAbsolutePath

getCurrentDirectory

public static java.io.File getCurrentDirectory()
Returns the editor internal currentDirectory.

Returns:
The editor internal currentDirectory

getCurrentDirectoryPath

public static java.lang.String getCurrentDirectoryPath()
Returns the editor internal currentDirectoryPath.

Returns:
The editor internal currentDirectoryPath

convertToPartial

public static java.lang.String convertToPartial(java.io.File file)
Converts the specified internal file absolute path to a current directory partial path.

Parameters:
file - The specified internal file
Returns:
The file partial path

convertToPartial

public static java.lang.String convertToPartial(java.lang.String path)
Converts the specified internal file absolute path to a current directory partial path.

Parameters:
path - The specified internal file path
Returns:
The file partial path

removeDirectoryPath

public static java.lang.String removeDirectoryPath(java.lang.String directory,
                                                   java.lang.String path)
Removes the specified directory from the specified path.

Parameters:
directory - The specified directory
path - The specified path
Returns:
Specified

convertToAbsolute

public static java.lang.String convertToAbsolute(java.lang.String path)
Converts the specified internal file partial path to an absolute path adding the current directory path.

Parameters:
path - The specified internal file partial path
Returns:
The file absolute path

deleteCurrentDirectory

public static void deleteCurrentDirectory()
Deletes the current directory and all its contents.


cleanCurrentDirectory

public static void cleanCurrentDirectory()
Deletes all the current directory contents.


deleteDirectory

public static void deleteDirectory(java.io.File directory)
Deletes the specified directory and all its contents.

Parameters:
directory - The specified directory

copyFile

public static void copyFile(java.io.File in,
                            java.io.File out)
                     throws java.io.IOException
Copies the content of an in file to an out file.

Parameters:
in - The in file
out - The out file
Throws:
java.io.IOException - If there is a problem with any of both files

getFilename

public static java.lang.String getFilename(java.lang.String filePath)

getExtension

public static java.lang.String getExtension(java.lang.String filePath)