Class ResourceHandle
java.lang.Object
org.eclipse.ease.modules.platform.resources.FilesystemHandle
org.eclipse.ease.modules.platform.resources.ResourceHandle
- All Implemented Interfaces:
Closeable,AutoCloseable,IFileHandle
public class ResourceHandle extends FilesystemHandle
-
Field Summary
Fields inherited from interface org.eclipse.ease.modules.platform.resources.IFileHandle
APPEND, READ, WRITE -
Constructor Summary
Constructors Constructor Description ResourceHandle(org.eclipse.core.resources.IFile file, int mode) -
Method Summary
Modifier and Type Method Description booleancreateFile(boolean createHierarchy)Create a file.static booleancreateFolder(org.eclipse.core.resources.IContainer container)Create a new container on the workbench.booleanexists()Check if a physical file exists.ObjectgetFile()Get the base file object.PathgetPath()Returns the java.io.File Path to the underlying file.voidwrite(byte[] data)Write data to a file.voidwrite(String data)Write data to a file.
-
Constructor Details
-
ResourceHandle
public ResourceHandle(org.eclipse.core.resources.IFile file, int mode)
-
-
Method Details
-
write
Description copied from interface:IFileHandleWrite data to a file. Uses platform default encoding to write strings to the file.- Specified by:
writein interfaceIFileHandle- Overrides:
writein classFilesystemHandle- Parameters:
data- data to write- Throws:
IOException- on write errors
-
write
Description copied from interface:IFileHandleWrite data to a file.- Specified by:
writein interfaceIFileHandle- Overrides:
writein classFilesystemHandle- Parameters:
data- data to write- Throws:
IOException- on write errors
-
getPath
Description copied from interface:IFileHandleReturns the java.io.File Path to the underlying file.- Specified by:
getPathin interfaceIFileHandle- Overrides:
getPathin classFilesystemHandle- Returns:
- Path of the file
-
exists
public boolean exists()Description copied from interface:IFileHandleCheck if a physical file exists.- Specified by:
existsin interfaceIFileHandle- Overrides:
existsin classFilesystemHandle- Returns:
truewhen file exists
-
createFile
Description copied from interface:IFileHandleCreate a file.- Specified by:
createFilein interfaceIFileHandle- Overrides:
createFilein classFilesystemHandle- Parameters:
createHierarchy- create parent folders if they do not exist- Returns:
trueon success- Throws:
IOException
-
createFolder
public static boolean createFolder(org.eclipse.core.resources.IContainer container) throws IOExceptionCreate a new container on the workbench.- Parameters:
container- container to create- Returns:
trueon success- Throws:
org.eclipse.core.runtime.CoreException- thrown when folder cannot be createdIOException
-
getFile
Description copied from interface:IFileHandleGet the base file object. Returns anIFileor aFileinstance.- Specified by:
getFilein interfaceIFileHandle- Overrides:
getFilein classFilesystemHandle- Returns:
- base file object
-