Class URIUtils
- java.lang.Object
-
- org.eclipse.emf.edapt.internal.common.URIUtils
-
public final class URIUtils extends Object
Helper methods for conversions between different types of resource identifiers- Version:
- $Rev$
- Author:
- herrmama, $Author$
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.eclipse.core.resources.IFile
getFile(org.eclipse.emf.common.util.URI uri)
Convert EMF URI to Eclipse filestatic org.eclipse.core.resources.IFolder
getFolder(org.eclipse.emf.common.util.URI uri)
Convert EMF URI to Eclipse folderstatic InputStream
getInputStream(org.eclipse.emf.common.util.URI uri)
Get an input stream from the given URI.static File
getJavaFile(org.eclipse.emf.common.util.URI uri)
Get the Java file for a URIstatic OutputStream
getOutputStream(org.eclipse.emf.common.util.URI uri)
Get an output stream from the given URI.static org.eclipse.emf.common.util.URI
getRelativePath(org.eclipse.emf.common.util.URI uri, org.eclipse.emf.common.util.URI relativeTo)
Get the relative path of aURI
w.r.t.static org.eclipse.emf.common.util.URI
getURI(File file)
Convert a file name to an EMF URIstatic org.eclipse.emf.common.util.URI
getURI(String fileName)
Convert a file name to an EMF URIstatic org.eclipse.emf.common.util.URI
getURI(URL url)
Get EMF URI from Java URLstatic org.eclipse.emf.common.util.URI
getURI(org.eclipse.core.resources.IResource file)
Convert Eclipse resource to EMF URIstatic org.eclipse.emf.common.util.URI
getURI(org.eclipse.core.runtime.IPath path)
Create an EMF URI from an Eclipse pathstatic URL
getURL(org.eclipse.emf.common.util.URI uri)
Get Java URL from EMF URIstatic String
incrementVersionSegment(String segment)
Increment the first part of a version number in a URI segment, as might be in a package namespace URI, if it appears to contain a version number.static org.eclipse.core.resources.IFile
replaceExtension(org.eclipse.core.resources.IFile file, String ext)
Replace extension of a filestatic org.eclipse.emf.common.util.URI
replaceExtension(org.eclipse.emf.common.util.URI uri, String ext)
Replace extension of a EMF URI
-
-
-
Method Detail
-
getFile
public static org.eclipse.core.resources.IFile getFile(org.eclipse.emf.common.util.URI uri)
Convert EMF URI to Eclipse file
-
getFolder
public static org.eclipse.core.resources.IFolder getFolder(org.eclipse.emf.common.util.URI uri)
Convert EMF URI to Eclipse folder
-
getURI
public static org.eclipse.emf.common.util.URI getURI(org.eclipse.core.resources.IResource file)
Convert Eclipse resource to EMF URI
-
getURI
public static org.eclipse.emf.common.util.URI getURI(org.eclipse.core.runtime.IPath path)
Create an EMF URI from an Eclipse path
-
getURI
public static org.eclipse.emf.common.util.URI getURI(String fileName)
Convert a file name to an EMF URI- Parameters:
fileName
-- Returns:
- EMF URI
-
getURI
public static org.eclipse.emf.common.util.URI getURI(File file)
Convert a file name to an EMF URI- Parameters:
file
-- Returns:
- EMF URI
-
getURL
public static URL getURL(org.eclipse.emf.common.util.URI uri)
Get Java URL from EMF URI- Parameters:
uri
- EMF URI- Returns:
- Java URL
-
getURI
public static org.eclipse.emf.common.util.URI getURI(URL url)
Get EMF URI from Java URL- Parameters:
url
- Java URL- Returns:
- EMF URI
-
replaceExtension
public static org.eclipse.core.resources.IFile replaceExtension(org.eclipse.core.resources.IFile file, String ext)
Replace extension of a file- Parameters:
file
- Fileext
- New extension- Returns:
- New file
-
replaceExtension
public static org.eclipse.emf.common.util.URI replaceExtension(org.eclipse.emf.common.util.URI uri, String ext)
Replace extension of a EMF URI- Parameters:
uri
- EMF URIext
- New extension- Returns:
- New EMF URI
-
getJavaFile
public static File getJavaFile(org.eclipse.emf.common.util.URI uri)
Get the Java file for a URI- Parameters:
uri
-- Returns:
- Java file
-
getInputStream
public static InputStream getInputStream(org.eclipse.emf.common.util.URI uri)
Get an input stream from the given URI.- Returns:
- an
InputStream
ornull
if no stream could be created
-
getOutputStream
public static OutputStream getOutputStream(org.eclipse.emf.common.util.URI uri)
Get an output stream from the given URI.- Returns:
- an
OutputStream
ornull
if no stream could be created
-
getRelativePath
public static org.eclipse.emf.common.util.URI getRelativePath(org.eclipse.emf.common.util.URI uri, org.eclipse.emf.common.util.URI relativeTo)
Get the relative path of aURI
w.r.t. anotherURI
.
-
incrementVersionSegment
public static String incrementVersionSegment(String segment)
Increment the first part of a version number in a URI segment, as might be in a package namespace URI, if it appears to contain a version number.- Parameters:
segment
- an URI segment- Returns:
- the incremented
segment
, or just thesegment
as is if it does not appear to be or to contain a discrete a version number
-
-