 +     * @return  bool
 +     */
 +    function providesClass($class) {
-+      return $this->archive->contains($class);
-+    }    
++      return $this->archive->contains(strtr($class, '.', '/').'.class.php');
++    }
++    
++    /**
++     * Fetch instance of classloader by the path to the archive
++     *
++     * @model   static
++     * @access  public
++     * @param   string path
++     * @return  &lang.archive.ArchiveClassLoader
++     */
++    function &instanceFor($path) {
++      static $pool= array();
++      
++      if (isset($pool[$path])) {
++        return $pool[$path];
++      }
++      
++      $instance= &new ArchiveClassLoader(new ArchiveReader($path));
++      $pool[$path]= $instance;
++      return $instance;
++    }
    }
  ?>
 Index: lang/archive/Archive.class.php
 ===================================================================
---- lang/archive/Archive.class.php	(revision 7907)
+--- lang/archive/Archive.class.php	(revision 8050)
 +++ lang/archive/Archive.class.php	(working copy)
-@@ -97,6 +97,25 @@
+@@ -4,13 +4,8 @@
+  * $Id$
+  */
+  
+-  uses('lang.ElementNotFoundException');
++  uses('lang.ElementNotFoundException', 'io.EncapsedStream');
+ 
+-  define('ARCHIVE_READ',             0x0000);
+-  define('ARCHIVE_CREATE',           0x0001);
+-  define('ARCHIVE_HEADER_SIZE',      0x0100);
+-  define('ARCHIVE_INDEX_ENTRY_SIZE', 0x0100);
+-
+   /**
+    * Archives contain a collection of classes.
+    *
+@@ -97,6 +92,25 @@
      }
      
      /**

       }
       xp::registry('sapi', $a);
     }
@@ -223,10 +240,44 @@
     xp::registry('errors', $errors);
   }
   // }}}
+  
+  // {{{ string __xp_load_archive_bytes(string archive, string filename)
+  //     Loads a file from an archive
+  function __xp_load_archive_bytes($archive, $filename) {
+    static $h= array();
+    static $bootstrap= array();
 
+    // Bootstrap loading, only to be used for core classes.
+    if (!is_resource($h[$archive])) {
+      $h[$archive]= fopen($archive, 'rb');
+      $header= unpack('a3id/c1version/i1indexsize/a*reserved', fread($h[$archive], 0x0100));
+      for ($bootstrap[$archive]= array(), $i= 0; $i < $header['indexsize']; $i++) {
+        $entry= unpack(
+          'a80id/a80filename/a80path/i1size/i1offset/a*reserved', 
+          fread($h[$archive], 0x0100)
+        );
+        $bootstrap[$archive][$entry['id']]= array($entry['size'], $entry['offset']);
+      }
+    }
+
+    if (!isset($bootstrap[$archive][$filename])) return FALSE;
+    fseek($h[$archive], 0x0100 + sizeof($bootstrap[$archive]) * 0x0100 + $bootstrap[$archive][$filename][1], SEEK_SET);
+    $bytes= fread($h[$archive], $bootstrap[$archive][$filename][0]);
+    return $bytes;
+  }
+  // }}}

Index: lang.base.php
===================================================================
--- lang.base.php	(revision 8050)
+++ lang.base.php	(working copy)
@@ -137,7 +137,24 @@
     //     Sets an SAPI
