|
EGF Engine Release 0.1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.egf.common.helper.FileHelper
public class FileHelper
Constructor Summary | |
---|---|
FileHelper()
|
Method Summary | |
---|---|
static String |
convertPackageNameToFolderPath(String packageName_p)
Convert package name to a correct java folder path. |
static void |
copyFile(String sourceFileRelativePath_p,
String targetFileRelativePath_p)
Copy given source file content in given target file. |
static boolean |
deleteFile(String fileRelativePath_p)
Delete given relative resource in the workspace. |
static boolean |
deleteFolder(String folderRelativePath_p)
Delete given relative folder in the workspace. |
static boolean |
deleteResource(IFolder root_p,
IResource resource_p,
boolean deleteParent_p)
Delete a workspace Resource. |
static boolean |
deleteResource(IResource resource_p)
Delete given relative resource in the workspace. |
static void |
ensurePathAvailability(String fileFullPath_p)
Make sure that given path is safe to use, ie ensure that all parent folders exist. |
static boolean |
exists(String fileRelativePath_p)
Is given file relative path pointing to an existing file ? |
static String |
getFileExtension(String filePath_p)
Returns the file extension portion for given file path, or null if there is none. |
static URI |
getFileFullUri(String fileRelativePath_p)
Get a file uri from relative one which is not resolved against the eclipse platform. |
static URL |
getFileFullUrl(String fileRelativePath_p)
Get file full url from relative one. |
static URL |
getFileFullUrl(URI fileFullUri_p)
Get file full url from its full uri. |
static IFile |
getPlatformFile(String fileRelativePath_p)
Get platform file as an IResource from its relative path. |
static IFolder |
getPlatformFolder(String folderRelativePath_p)
Get platform folder as an IResource from its relative path. |
static IResource |
getPlatformResource(IPath path_p)
Get platform IResource as an IResource from its relative IPath. |
static boolean |
makeFileWritable(String filePath_p)
Make file writable. |
static boolean |
moveResource(IResource resource_p,
IPath destinationPath_p)
Move resource to given destination path. |
static byte[] |
readFile(InputStream inputStream_p)
Read given input stream as an array of bytes. |
static String |
readFile(String filePath_p)
Read file as a string. |
static InputStream |
readFileAsStream(String filePath_p)
Get file as a stream. |
static byte[] |
readRawFile(String filePath_p)
Read file as an array of bytes. |
static boolean |
renameFile(String sourceFileRelativePath_p,
String destinationFileRelativePath_p)
Rename file from source file relative path to destination relative path. |
static boolean |
renameFolder(String sourceFolderRelativePath_p,
String destinationFolderRelativePath_p)
Rename folder from source folder relative path to destination relative path. |
static boolean |
writeFile(String filePath_p,
boolean ensureFolders_p,
byte[] contents_p)
Write given contents of bytes at specified path. |
static boolean |
writeFile(String filePath_p,
boolean ensureFolders_p,
String contents_p)
Write given string contents at specified path. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileHelper()
Method Detail |
---|
public static URL getFileFullUrl(String fileRelativePath_p)
fileRelativePath_p
- File path relative to workspace.public static URL getFileFullUrl(URI fileFullUri_p)
getFileFullUri(String)
method.
fileFullUri_p
-
public static URI getFileFullUri(String fileRelativePath_p)
fileRelativePath_p
- File path relative to workspace.URI
not resolved against the eclipse platform.public static String convertPackageNameToFolderPath(String packageName_p)
packageName_p
-
public static byte[] readFile(InputStream inputStream_p)
inputStream_p
-
public static String readFile(String filePath_p)
filePath_p
- File path relative to the plug-in, plug-in id included.getFileFullUrl(String)
documentation.
ICommonConstants.EMPTY_STRING
is returned.public static InputStream readFileAsStream(String filePath_p)
filePath_p
- File path relative to the plug-in, plug-in id included.getFileFullUrl(String)
documentation.
public static byte[] readRawFile(String filePath_p)
filePath_p
- File path relative to the plug-in, plug-in id included.getFileFullUrl(String)
documentation.
public static void copyFile(String sourceFileRelativePath_p, String targetFileRelativePath_p)
sourceFileRelativePath_p
- File path relative to the plug-in, plug-in id included.getFileFullUrl(String)
documentation.targetFileRelativePath_p
- File path relative to the plug-in, plug-in id included.getFileFullUrl(String)
documentation.public static boolean writeFile(String filePath_p, boolean ensureFolders_p, String contents_p)
filePath_p
- File path relative to the plug-in, plug-in id included.getFileFullUrl(String)
documentation.ensureFolders_p
- Make sure all parent folders exist by creating all necessary ones.contents_p
- Contents that should be written to pointed file.
public static boolean writeFile(String filePath_p, boolean ensureFolders_p, byte[] contents_p)
filePath_p
- File path relative to the plug-in, plug-in id included.getFileFullUrl(String)
documentation.ensureFolders_p
- Make sure all parent folders exist by creating all necessary ones.contents_p
- Contents that should be written to pointed file.
public static boolean renameFile(String sourceFileRelativePath_p, String destinationFileRelativePath_p)
sourceFileRelativePath_p
- File path relative to the plug-in, plug-in id included.getFileFullUrl(String)
documentation.destinationFileRelativePath_p
- File path relative to the plug-in, plug-in id included.getFileFullUrl(String)
documentation.
public static boolean renameFolder(String sourceFolderRelativePath_p, String destinationFolderRelativePath_p)
sourceFolderRelativePath_p
- Folder path relative to the plug-in, plug-in id included.getFileFullUrl(String)
documentation.destinationFolderRelativePath_p
- Folder path relative to the plug-in, plug-in id included.getFileFullUrl(String)
documentation.
public static boolean moveResource(IResource resource_p, IPath destinationPath_p)
resource_p
- destinationPath_p
-
public static boolean exists(String fileRelativePath_p)
fileRelativePath_p
- File path relative to the plug-in, plug-in id included.getFileFullUrl(String)
documentation.
public static void ensurePathAvailability(String fileFullPath_p)
fileFullPath_p
- public static boolean deleteResource(IFolder root_p, IResource resource_p, boolean deleteParent_p)
javaProject_p
- resourcePath_p
- public static boolean deleteFile(String fileRelativePath_p)
fileRelativePath_p
- public static boolean deleteFolder(String folderRelativePath_p)
workspaceRelativePath_p
-
public static boolean deleteResource(IResource resource_p)
resource_p
- public static IResource getPlatformResource(IPath path_p)
IResource
from its relative IPath.
path_p
- IPath relative to workspace.public static IFile getPlatformFile(String fileRelativePath_p)
IResource
from its relative path.
fileRelativePath_p
- File path relative to the plug-in, plug-in id included.getFileFullUrl(String)
documentation.
public static IFolder getPlatformFolder(String folderRelativePath_p)
IResource
from its relative path.
folderRelativePath_p
- Folder path relative to the plug-in, plug-in id included.getFileFullUrl(String)
documentation.
public static String getFileExtension(String filePath_p)
null
if there is none.
The file extension portion is defined as the string
following the last period (".") character in the last segment.
If there is no period in the last segment, the path has no
file extension portion. If the last segment ends in a period,
the file extension portion is the empty string.
filePath_p
-
null
public static boolean makeFileWritable(String filePath_p)
filePath_p
- File path relative to the plug-in, plug-in id included.
See getFileFullUrl(String)
documentation.
|
EGF Engine Release 0.1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright (c) Thales Corporate Services S.A.S, 2009.
This page is made available under license. For full details see the LEGAL in the documentation book that contains this page.