code: public void pack( Map<String, URI> agg, OutputStream out )
          throws IOException
      {
          // calculate the final map
  
          JarOutputStream jout = new JarOutputStream( out );
          try
          {
              // first set manifest if available:
              URI manifest = agg.get( "META-INF/MANIFEST.MF" );
              if( manifest != null )
              {
                  JarEntry entry = new JarEntry( "META-INF/MANIFEST.MF" );
                  jout.putNextEntry( entry );
                  StreamUtils.copyStream( manifest.toURL().openStream(), jout, false );
                  jout.closeEntry();
              }
              for( String name : agg.keySet() )
              {
                  if( name.equals( "META-INF/MANIFEST.MF" ) )
                  {
                      continue;
                  }
  
                  JarEntry entry = new JarEntry( name );
                  jout.putNextEntry( entry );
                  StreamUtils.copyStream( agg.get( name ).toURL().openStream(), jout, false );
                  jout.closeEntry();
              }
          } finally
          {
              jout.close();
          }
  
      }
docs: Just pack fully resolved resources into an outputstream.
  
  @param agg
  @param out