/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* vim: set shiftwidth=4 tabstop=4 autoindent cindent expandtab: */ 'use strict'; var getClassImage = function(classBytes) { var classImage = {}; var getAttributes = function(attribute_name_index, bytes) { var reader = new Reader(bytes); var attribute = { attribute_name_index: attribute_name_index }; var item = classImage.constant_pool[attribute_name_index]; switch(item.tag) { case TAGS.CONSTANT_Long: case TAGS.CONSTANT_Float: case TAGS.CONSTANT_Double: case TAGS.CONSTANT_Integer: case TAGS.CONSTANT_String: attribute.type = ATTRIBUTE_TYPES.ConstantValue; attribute.info = reader.read16(); return attribute; case TAGS.CONSTANT_Utf8: switch(item.bytes) { case ATTRIBUTE_TYPES.Code: attribute.type = ATTRIBUTE_TYPES.Code; attribute.max_stack = reader.read16(); attribute.max_locals = reader.read16(); var code_length = reader.read32(); attribute.code = reader.readBytes(code_length); var exception_table_length = reader.read16(); attribute.exception_table = []; for (var i=0; i