/** {@inheritDoc} */
 public ClassSpec getClassSpec(final String name) throws IOException {
   final VirtualFile file = root.getChild(name);
   if (!file.exists()) {
     return null;
   }
   final long size = file.getSize();
   final ClassSpec spec = new ClassSpec();
   final InputStream is = file.openStream();
   try {
     if (size <= (long) Integer.MAX_VALUE) {
       final int castSize = (int) size;
       byte[] bytes = new byte[castSize];
       int a = 0, res;
       while ((res = is.read(bytes, a, castSize - a)) > 0) {
         a += res;
       }
       // done
       is.close();
       spec.setBytes(bytes);
       spec.setCodeSource(new CodeSource(rootUrl, file.getCodeSigners()));
       return spec;
     } else {
       throw ServerMessages.MESSAGES.resourceTooLarge();
     }
   } finally {
     VFSUtils.safeClose(is);
   }
 }
 public TestResourceLoaderBuilder addClass(final Class<?> aClass) throws Exception {
   final ClassSpec classSpec = new ClassSpec();
   classSpec.setCodeSource(aClass.getProtectionDomain().getCodeSource());
   final byte[] classBytes = getClassBytes(aClass);
   classSpec.setBytes(classBytes);
   addClassSpec(aClass.getName(), classSpec);
   return this;
 }