{
    String platformResourcePath = uri.toPlatformString(true);
    if (workspaceRoot != null)
    {
      return WorkbenchHelper.createPlatformResourceOutputStream(platformResourcePath, options);
    }
    else
    {
      URI resolvedLocation = EcorePlugin.resolvePlatformResourcePath(platformResourcePath);
      if (resolvedLocation != null)
      {
        return ((URIConverter)options.get(URIConverter.OPTION_URI_CONVERTER)).createOutputStream(resolvedLocation, options);
      }

      throw new IOException("The path '" + platformResourcePath + "' is unmapped");
    }
  }