Runtime

## org.eclipse.gmf.runtime.common.ui.util
Class FileUtil

    java.lang.Object
      org.eclipse.gmf.runtime.common.ui.util.FileUtil

public class FileUtil
extends java.lang.Object

This class provides general methods for operating on files.

Constructor Summary
`FileUtil()`

Method Summary
`static void` `createFile(IFile fileHandle, java.io.InputStream contents, IProgressMonitor monitor)` Creates a file resource given the file handle and contents.
`static void` `deleteFile(IFile fileHandle, IProgressMonitor monitor)` Deletes a file resource given the file handle.
`static java.lang.String` `getAbsolutePath(java.lang.String strurlPath, java.lang.String strmodelPath)` make the absolute path from relative url path and base model path
`static java.lang.String` `getRelativePath(java.lang.String urlPathstr, java.lang.String modelPathstr)` Build the relative path according to the url path and model path

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

Constructor Detail

### FileUtil

    public FileUtil()

Method Detail

### createFile

    public static void createFile(IFile fileHandle,
                                  java.io.InputStream contents,
                                  IProgressMonitor monitor)
                           throws CoreException

  Creates a file resource given the file handle and contents.

  Parameters:
    `fileHandle` - the file handle to create a file resource with
    `contents` - the initial contents of the new file resource, or `null` if none (equivalent to an empty stream)
    `monitor` - the progress monitor to show visual progress with
  Throws:
    `CoreException` - if the operation fails

### deleteFile

    public static void deleteFile(IFile fileHandle,
                                  IProgressMonitor monitor)
                           throws CoreException

  Deletes a file resource given the file handle.

  Parameters:
    `fileHandle` - the file handle to delete.
    `monitor` - the progress monitor to show visual progress with
  Throws:
    `CoreException` - if the operation fails

### getRelativePath

    public static java.lang.String getRelativePath(java.lang.String urlPathstr,
                                                   java.lang.String modelPathstr)

  Build the relative path according to the url path and model path

  Parameters:
    `urlPathstr` - the url path, make sure the url is a file path, otherwise do not change.
    `modelPathstr` - the model's path
  Returns:
    the relative path

### getAbsolutePath

    public static java.lang.String getAbsolutePath(java.lang.String strurlPath,
                                                   java.lang.String strmodelPath)

  make the absolute path from relative url path and base model path

  Parameters:
    `strurlPath` - the URL Path String
    `strmodelPath` - the absolute Model Path
  Returns:
    the relative path String

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.