* @throws java.io.IOException
*/
public ClassInfo load(byte bitfield, CapInputStream in) throws UnableToReadCapFileException {
ClassInfo classInfo = new ClassInfo();
classInfo.setFlags(bitfield);
// superClassRef loading
classInfo.setSuperClassRef(new ClassRefRead().load(in));
// declaredInstancedSize reading
classInfo.setDeclaredInstanceSize(in.readByte());
// firstRefToken reading
classInfo.setFirstReferenceToken(in.readByte());
// refCount reading
classInfo.setReferenceCount(in.readByte());
// publicMethodTableBase reading
classInfo.setPublicMethodTableBase(in.readByte());
// publicMethodTableCount reading
classInfo.setPublicMethodTableCount(in.readByte());
// packageMethodTableBase reading
classInfo.setPackageMethodTableBase(in.readByte());
// packageMethodTableCount reading
classInfo.setPackageMethodTableCount(in.readByte());
// publicVirtualMethodTable reading
classInfo.getPublicVirtualMethodTable().clear();
for (int i = 0; i < classInfo.getPublicMethodTableCount(); i++) {
classInfo.getPublicVirtualMethodTable().add(in.readShort());
}
// packageVirtualMethodTable reading
classInfo.getPackageVirtualMethodTable().clear();
for (int i = 0; i < classInfo.getPackageMethodTableCount(); i++) {
classInfo.getPackageVirtualMethodTable().add(in.readShort());
}
// interfaces reading
classInfo.getInterfaces().clear();
// the number of entries entries in the interfaces array
// is in the second nibble of the bitField
byte interfaceCount = (byte) (bitfield & 0x0F);
for (int i = 0; i < interfaceCount; i++) {
ImplementedInterfaceInfo impInt = new ImplementedInterfaceInfoRead().load(in);
classInfo.getInterfaces().add(impInt);
}
// remoteInterfaces reading
// only if the ACC_REMOTE flag has the value 0
if ((bitfield & ClassComponent.ACC_REMOTE) == ClassComponent.ACC_REMOTE) {
classInfo.setRemoteInterfacesInfo(new RemoteInterfaceInfoRead().load(in));
} else {
classInfo.setRemoteInterfacesInfo(null);
}
return classInfo;
}