public final class ResourceTools extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
exists(Object location)
Verifies that a readable source (file/stream) exists at location.
|
static InputStream |
getInputStream(Object location) |
static Object |
getResource(Object location)
Get an existing resource (file/folder/URI).
|
static Object |
resolveFile(Object location,
Object parent,
boolean exists)
Resolve a file from a given input location.
|
static Object |
resolveFolder(Object location,
Object parent,
boolean exists)
Resolve a folder from a given input location.
|
static String |
toAbsoluteLocation(Object location,
Object parent) |
static IPath |
toPath(String location)
Convert a location to a path in the workspace.
|
static String |
toProjectRelativeLocation(Object location,
Object parent) |
static String |
toString(InputStream stream)
Convert an input stream to a string.
|
static String |
toString(Reader reader)
Read characters from a
Reader and return its string representation. |
static URI |
toURI(IPath path)
|
public static Object resolveFile(Object location, Object parent, boolean exists)
public static Object resolveFolder(Object location, Object parent, boolean exists)
location - folder location to be resolvedparent - location of parent resourceexists - return folder only if it existsIContainer, File or nullpublic static String toProjectRelativeLocation(Object location, Object parent)
public static boolean exists(Object location)
location - location to verifytrue when location is readablepublic static Object getResource(Object location)
public static InputStream getInputStream(Object location)
public static URI toURI(IPath path)
path - The path to convertpublic static IPath toPath(String location)
location - location to convert (workspace://...)public static String toString(InputStream stream) throws IOException
stream - input string to read fromIOException - thrown on problems with input streampublic static String toString(Reader reader) throws IOException
Reader and return its string representation. Can be used to convert an InputStream to a string.reader - reader to read fromIOException - when reader is not accessible