Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.birt.report.model.api.util
Class URIUtil

    java.lang.Object
      org.eclipse.birt.report.model.api.util.URIUtil

    public class URIUtil

extends java.lang.Object

Utility class to handle URI.

Field Summary
`static java.lang.String` | `FILE_SCHEMA` File schema.

Constructor Summary
`URIUtil()`

Method Summary
`static java.lang.String` | `convertFileNameToURLString(java.lang.String filePath)` Converts a filename to a valid URL string.
`static java.net.URL` | `getDirectory(java.lang.String filePath)` Deprecated. not supported
`static java.net.URL` | `getDirectory(java.net.URL url)` Deprecated. not supported
`static java.lang.String` | `getLocalPath(java.lang.String uri)` Checks `uri` is file path.
`static java.lang.String` | `getRelativePath(java.lang.String base, java.lang.String resource)` Return the relative path for the given `resource` according to `base`.
`static boolean` | `isValidResourcePath(java.lang.String resourceDir)` Tests whether the input string is a valid resource directory.
`static java.lang.String` | `resolveAbsolutePath(java.lang.String base, java.lang.String relativePath)` Gets the absolute path for the given `base` and `relativePath` .

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### FILE_SCHEMA

    public static final java.lang.String FILE_SCHEMA

  File schema.

  See Also:
    Constant Field Values

Constructor Detail

### URIUtil

    public URIUtil()

Method Detail

### getLocalPath

    public static java.lang.String getLocalPath(java.lang.String uri)

  Checks `uri` is file path. If `uri` is an absolute uri and refers to a file, removes "file://" and returns the file path. If `uri` is relative uri and refers to a file, returns the `uri`. For other cases, returns null.

  For examples, following uri are supported:

  - file://C:/disk/test/data.file
  - /C:/disk/test/data.file
  - /usr/local/disk/test/data.file
  - C:\\disk\\test/data.file
  - C:/disk/test/data.file
  - ./test/data.file

  Parameters:
    `uri` - the input uri
  Returns:
    the file path if `uri` refers to a file. Otherwise null.

### convertFileNameToURLString

    public static java.lang.String convertFileNameToURLString(java.lang.String filePath)

  Converts a filename to a valid URL string. The filename can include directory information, either relative or absolute directory.

  Parameters:
    `filePath` - the file name
  Returns:
    a valid URL String

### getDirectory

    public static java.net.URL getDirectory(java.lang.String filePath)

  Deprecated. not supported

  Returns the directory of the given file name in a valid URL. The filename can include directory information, either relative or absolute directory. And the file should be on the local disk. The parameter filePath should be decoded. If the filePath is encoded, it should be converted to URL and call getDirectory as the parameter.

  Parameters:
    `filePath` - the file name
  Returns:
    a valid URL

### getDirectory

    public static java.net.URL getDirectory(java.net.URL url)

  Deprecated. not supported

  Returns the directory of the given file name in a valid URL.The filename can include directory information, either relative or absolute directory. And the file should be on the local disk. The url has been encoded.

  Parameters:
    `url` - the url of the file.
  Returns:
    a valid URL

### getRelativePath

    public static java.lang.String getRelativePath(java.lang.String base,
                                                   java.lang.String resource)

  Return the relative path for the given `resource` according to `base`. Only handle file system and valid url syntax.

  The `base` value should be directory ONLY and does NOT contain file name and the format can be:

  - ./../hello/
  - C:\\hello\..\
  - /C:/../hello/
  The spearator in the return path is platform-indepedent "/". Please note that the `/` in the end of directory will be striped in the return value.

  Parameters:
    `base` - the base directory
    `resource` - the full path
  Returns:
    the relative path.

### resolveAbsolutePath

    public static java.lang.String resolveAbsolutePath(java.lang.String base,
                                                       java.lang.String relativePath)

  Gets the absolute path for the given `base` and `relativePath` .

  The `base` value should be directory ONLY and does NOT contain file name and the format can be:

  - ./../hello/
  - C:\\hello\..\
  - /C:/../hello/
  The spearator in the return path is platform-depedent.

  Parameters:
    `base` - the base directory
    `relativePath` - the relative path
  Returns:
    the absolute path

### isValidResourcePath

    public static boolean isValidResourcePath(java.lang.String resourceDir)

  Tests whether the input string is a valid resource directory.

  Parameters:
    `resourceDir` - the resource directory
  Returns:
    `true` if the input string is a valid resource directory, `false` otherwise.
  Throws:
    `java.net.MalformedURLException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008 Actuate Corp. All rights reserved.