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 boolean
createFile(boolean createHierarchy)
Create a file.static boolean
createFolder(org.eclipse.core.resources.IContainer container)
Create a new container on the workbench.boolean
exists()
Check if a physical file exists.Object
getFile()
Get the base file object.Path
getPath()
Returns the java.io.File Path to the underlying file.void
write(byte[] data)
Write data to a file.void
write(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:IFileHandle
Write data to a file. Uses platform default encoding to write strings to the file.- Specified by:
write
in interfaceIFileHandle
- Overrides:
write
in classFilesystemHandle
- Parameters:
data
- data to write- Throws:
IOException
- on write errors
-
write
Description copied from interface:IFileHandle
Write data to a file.- Specified by:
write
in interfaceIFileHandle
- Overrides:
write
in classFilesystemHandle
- Parameters:
data
- data to write- Throws:
IOException
- on write errors
-
getPath
Description copied from interface:IFileHandle
Returns the java.io.File Path to the underlying file.- Specified by:
getPath
in interfaceIFileHandle
- Overrides:
getPath
in classFilesystemHandle
- Returns:
- Path of the file
-
exists
public boolean exists()Description copied from interface:IFileHandle
Check if a physical file exists.- Specified by:
exists
in interfaceIFileHandle
- Overrides:
exists
in classFilesystemHandle
- Returns:
true
when file exists
-
createFile
Description copied from interface:IFileHandle
Create a file.- Specified by:
createFile
in interfaceIFileHandle
- Overrides:
createFile
in classFilesystemHandle
- Parameters:
createHierarchy
- create parent folders if they do not exist- Returns:
true
on 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:
true
on success- Throws:
org.eclipse.core.runtime.CoreException
- thrown when folder cannot be createdIOException
-
getFile
Description copied from interface:IFileHandle
Get the base file object. Returns anIFile
or aFile
instance.- Specified by:
getFile
in interfaceIFileHandle
- Overrides:
getFile
in classFilesystemHandle
- Returns:
- base file object
-