public class ResourceHandle extends FilesystemHandle
APPEND, READ, WRITE
Constructor and Description |
---|
ResourceHandle(IFile file,
int mode) |
Modifier and Type | Method and Description |
---|---|
boolean |
createFile(boolean createHierarchy)
Create a file.
|
static boolean |
createFolder(IContainer container)
Create a new container on the workbench.
|
boolean |
exists()
Check if a physical file exists.
|
java.lang.Object |
getFile()
Get the base file object.
|
java.nio.file.Path |
getPath()
Returns the java.io.File Path to the underlying file
|
void |
write(byte[] data)
Write data to a file.
|
void |
write(java.lang.String data)
Write data to a file.
|
close, read, readLine, setMode
public ResourceHandle(IFile file, int mode)
public void write(java.lang.String data) throws java.io.IOException
IFileHandle
write
in interface IFileHandle
write
in class FilesystemHandle
data
- data to writejava.io.IOException
- on write errorspublic void write(byte[] data) throws java.io.IOException
IFileHandle
write
in interface IFileHandle
write
in class FilesystemHandle
data
- data to writejava.io.IOException
- on write errorspublic java.nio.file.Path getPath()
IFileHandle
getPath
in interface IFileHandle
getPath
in class FilesystemHandle
public boolean exists()
IFileHandle
exists
in interface IFileHandle
exists
in class FilesystemHandle
true
when file existspublic boolean createFile(boolean createHierarchy) throws CoreException
IFileHandle
createFile
in interface IFileHandle
createFile
in class FilesystemHandle
createHierarchy
- create parent folders if they do not existtrue
on successCoreException
public static boolean createFolder(IContainer container) throws CoreException
container
- container to createtrue
on successCoreException
- thrown when folder cannot be createdpublic java.lang.Object getFile()
IFileHandle
IFile
or a File
instance.getFile
in interface IFileHandle
getFile
in class FilesystemHandle