public void write(DataOutputStream out) throws IOException {
		GrowableConstantPool gcp = new GrowableConstantPool();
		reserveSmallConstants(gcp);
		prepareWriting(gcp);

		out.writeInt(0xcafebabe);
		out.writeShort(3);
		out.writeShort(45);
		gcp.write(out);

		out.writeShort(modifiers);
		out.writeShort(gcp.putClassName(name));
		out.writeShort(gcp.putClassName(superclass.getName()));
		out.writeShort(interfaces.length);
		for (int i = 0; i < interfaces.length; i++)
			out.writeShort(gcp.putClassName(interfaces[i].getName()));

		out.writeShort(fields.length);
		for (int i = 0; i < fields.length; i++)
			fields[i].write(gcp, out);

		out.writeShort(methods.length);
		for (int i = 0; i < methods.length; i++)
			methods[i].write(gcp, out);

		writeAttributes(gcp, out);
	}