return new UnknownResource();
}
try {
Class c = Class.forName(classname);
Resource res = (Resource)c.newInstance();
Hashtable values = new Hashtable(10);
org.w3c.tools.resources.Attribute attrs[] =
org.w3c.tools.resources.AttributeRegistry.getClassAttributes(c);
boolean slowpickle = ! in.readBoolean();
if (slowpickle) {
String name = null;
while ( ! (name = in.readUTF()).equals("") ) {
int ai = lookupAttribute(name, attrs);
int as = ((int) in.readShort() & 0xffff);
if ( ai >= 0 ) {
Attribute oldattr = getOldAttribute(attrs[ai]);
Object value = oldattr.unpickle(in);
if (value != null)
values.put(name, value);
} else {
in.skip(as);
}
}
} else {
for (int i = 0 ; i < attrs.length ; i++) {
if ( in.readBoolean() ) {
Attribute oldattr = getOldAttribute(attrs[i]);
Object value = oldattr.unpickle(in);
if (value != null)
values.put(attrs[i].getName(), value);
}
}
}
res.pickleValues(values);
return res;
} catch (UTFDataFormatException utfex) {
//silent...
return null;
} catch (ClassNotFoundException cnfex) {