class ClassFileMetadataReader {

    public static ClassMetadata instance( InputStream stream ) throws Exception {
        ClassFile clazz = new ClassFile(new DataInputStream(stream));

        if ((AccessFlag.ENUM & clazz.getAccessFlags()) == AccessFlag.ENUM) {
            return new EnumMetadata(clazz);
        }

        return new ClassMetadata(clazz);
    }

}