return cf;
}
public static ClassFile readClass(byte[] data) {
// TODO: parse from stream
ByteParser parser = new ByteArrayByteParser(data);
parser.setBigEndian(true);
ClassFile cf = parseBasics(parser);
int interfaceCount = parser.getShortAsInt();
List<Interface> interfaces = new ArrayList<Interface>(interfaceCount);
for (int i = 0; i < interfaceCount; i++) {
interfaces.add(new Interface(parser.getShortAsInt(), cf.getPool()));
}
cf.setInterfaces(interfaces);
int fieldsCount = parser.getShortAsInt();
List<Field> fields = new ArrayList<Field>(fieldsCount);
for (int i = 0; i < fieldsCount; i++) {
Field f = new Field(parser, cf.getPool());
fields.add(f);
}
cf.setFields(fields);
int methodCount = parser.getShortAsInt();
List<Method> methods = new ArrayList<Method>(methodCount);
for (int i = 0; i < methodCount; i++) {
Method method = new Method(parser, cf.getPool());
methods.add(method);