public static Bundle installBundle(BundleContext context,InputStream bundleIS,boolean closeStream,boolean checkExistence) throws IOException, BundleException {
  String name=System.currentTimeMillis() + ".tmp";
  Resource dir=SystemUtil.getTempDirectory();
  Resource tmp=dir.getRealResource(name);
  int count=0;
  while (tmp.exists())   tmp=dir.getRealResource((count++) + "_" + name);
  IOUtil.copy(bundleIS,tmp,closeStream);
  try {
    return installBundle(context,tmp,checkExistence);
  }
  finally {
    tmp.delete();
  }
}

public static Bundle installBundle ( BundleContext context , InputStream bundleIS , boolean closeStream , boolean checkExistence ) throws IOException , BundleException { String name = System . currentTimeMillis ( ) + ".tmp" ; Resource dir = SystemUtil . getTempDirectory ( ) ; Resource tmp = dir . getRealResource ( name ) ; int count = 0 ; while ( tmp . exists ( ) ) tmp = dir . getRealResource ( ( count ++ ) + "_" + name ) ; IOUtil . copy ( bundleIS , tmp , closeStream ) ; try { return installBundle ( context , tmp , checkExistence ) ; } finally { tmp . delete ( ) ; } }
only installs a bundle , if the bundle does not already exist , if the bundle exists the existing bundle is unloaded first . the bundle is not stored physically on the system .
