|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.lapetus_ltd.api.common.TLptsFileUtil
public class TLptsFileUtil
Class Description : This is the class for file and directory operations.
Method Summary | |
---|---|
static java.lang.String |
createDirectoryPath(java.lang.String path)
Creates a new Directory. |
static java.lang.String |
getCurrentDirectory()
Gets the folder that the application is running in. |
static java.lang.String |
getCurrentParentDirectory()
Gets the parent of the folder that the application is running in. |
static java.util.List<java.lang.String> |
getFileList(java.lang.String dir,
java.lang.String extension,
boolean isGetFullPath)
This function gets all the files of the specified type in all sub directories. |
static java.lang.String |
getJavaHome()
Gets the Java Home directory. |
static java.lang.String |
getUserHomeDirectory()
Gets the users home directory, where the Java RT always has rights to access data. |
static java.lang.String |
getUserHomeLapetusDirectory()
Gets the users home directory and puts lapetus as a sub-directory on the end of it. |
static boolean |
isPath(java.lang.String path)
Checks to see if the path (directory of file) exists. |
static void |
zI()
Obfuscated, as it is not required by the application. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static java.lang.String createDirectoryPath(java.lang.String path)
Thread Safe : Yes
Spawns its own Thread : No
May Return NULL : N/A
Notes : Set the full path name of the directory you want to create.
Example :
// Method is going to create directory 'Projects' in /home/Documents/ path String dir = createDirectoryPath(/home/Documents/Projects/) System.out.println(dir); Result : /home/Documents/Projects/
path
- the full path name of the directory to create.
TLptsLogger
public static java.lang.String getCurrentDirectory()
Thread Safe : Yes
Spawns its own Thread : No
May Return NULL : N/A
Notes :
Example :
String dir = TLptsFileUtil.getCurrentDirectory(); System.out.println(dir); Result : /home/db_japi/
public static java.lang.String getCurrentParentDirectory()
Thread Safe : Yes
Spawns its own Thread : No
May Return NULL : N/A
Notes :
Example :
String dir = TLptsFileUtil.getCurrentParentDirectory(); System.out.println(dir); Result : /home/ and Current Directory is: /home/db_japi/
public static java.util.List<java.lang.String> getFileList(java.lang.String dir, java.lang.String extension, boolean isGetFullPath)
Thread Safe : Yes
Spawns its own Thread : No
May Return NULL : N/A
Notes :
Example :
Lets pretend we have the following directories and files: /dir1/dir2/file.ext1 /dir1/dir3/file.ext2 c:\dir1\dir4\file.ext1 ( '\' is changed to '/' for consistency) /dir2/dir6/file1.ext4 getFileList("/dir1","ext1",true) returns /dir1/dir2/file.ext1 and c:/dir1/dir4/file.ext1 getFileList("/dir2","ext4",false) returns dir6/file1.ext4
dir
- The directory to start looking in for all files and sub-directoriesextension
- The extension filter type. Put "" for all files or "EXT" without the period ".".isGetFullPath
- Returns the full path of the files in the list.
public static java.lang.String getJavaHome()
Thread Safe : Yes
Spawns its own Thread : No
May Return NULL : N/A
Notes : The same as the JAVA_HOME environment variable.
This may be under the JDK directory.
Example :
String dir = TLptsFileUtil.getJavaHome(); System.out.println(dir); Result : /Java/jdk1.6.0_10/jre
public static java.lang.String getUserHomeDirectory()
Thread Safe : Yes
Spawns its own Thread : No
May Return NULL : N/A
Notes : Use this directory to store information, without worrying about security rights.
Example :
String dir = TLptsFileUtil.getUserHomeDirectory(); System.out.println(dir); Result : /home/user/ or c:/Users/me/
public static java.lang.String getUserHomeLapetusDirectory()
Thread Safe : Yes
Spawns its own Thread : No
May Return NULL : N/A
Notes : Use this directory to store information, without worrying about security rights.
The lapetus sub-directory is always in lowercase.
If the directory does not exist it is created on the first call to this function.
Example :
String dir = TLptsFileUtil.getUserHomeLapetusDirectory(); System.out.println(dir); Result : /home/user/.lapetus-ltd/ or c:/Users/me/.lapetus-ltd/
public static boolean isPath(java.lang.String path)
Thread Safe : Yes
Spawns its own Thread : No
May Return NULL : N/A
Notes :
Example :
boolean doesPathExist = TLptsFileUtil.isPath(fileName); if (doesPathExist) System.out.println(FileName + " exists."); else System.out.println(FileName + " does not exist.");
path
- The path (file or dirtory) to verify for existence.
public static void zI()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |