50public class SectionArmAttributes 
extends Section {
 
   80    public static enum Tag {
 
  130        public static Tag get(
final int id) {
 
  131            final Tag[] tags = 
Tag.values();
 
  132            final int tag_count = tags.length;
 
  133            for(
int i=0; i < tag_count; i++) {
 
  134                if( tags[i].
id == 
id ) {
 
 
 
  147    public static class Attribute {
 
  149        private final Object value;
 
  151        Attribute(
final Tag tag, 
final Object value) {
 
  161                return (String) value;
 
  163            throw new IllegalArgumentException(
"Not NTBS but "+
tag.type);
 
 
  171                return ((Byte) value).byteValue();
 
  173            throw new IllegalArgumentException(
"Not ULEB128 but "+
tag.type);
 
 
  178            return tag+
" = "+value;
 
 
 
  182    public static class VendorAttributes {
 
 
  198    SectionArmAttributes(
final SectionHeader sh, 
final byte[] 
data, 
final int offset, 
final int length) 
throws IndexOutOfBoundsException, IllegalArgumentException {
 
  211            for(
int j=0; j<attributes.size(); j++) {
 
 
  221    public final List<Attribute> 
get(
final String vendor) {
 
 
  225    static final List<Attribute> 
get(
final List<VendorAttributes> 
vendorAttributesList, 
final String vendor) {
 
  228            if( vas.vendor.equals(vendor) ) {
 
  229                return vas.attributes;
 
  244    static List<VendorAttributes> parse(
final SectionHeader 
sh, 
final byte[] in, 
final int offset, 
final int remaining) 
throws IndexOutOfBoundsException, IllegalArgumentException {
 
  245        Bitstream.checkBounds(in, 
offset, remaining);
 
  248            throw new IllegalArgumentException(
"ShArmAttr: Not version A, but: "+toHexString(in[i]));
 
  255        while(i < remaining) {
 
  257            final int secLen = readUInt32(isBigEndian, in, i); 
 
  262                final int[] i_post = 
new int[] { 0 };
 
  263                vendor = getString(in, i, secLen - 4, i_post);
 
  267            final List<Attribute> attributes = 
new ArrayList<Attribute>();
 
  270                final int[] i_post = 
new int[] { 0 };
 
  271                parseSub(isBigEndian, in, i, secLen - i, i_post, attributes);
 
  275            if( i_pre + secLen != i ) {
 
  276                throw new IllegalArgumentException(
"ShArmAttr: Section length count mismatch, expected "+(i_pre + secLen)+
", has "+i);
 
  280            if( 
null != mergeAttribs ) {
 
  281                mergeAttribs.addAll(attributes);
 
  299    private static void parseSub(
final boolean isBigEndian, 
final byte[] in, 
final int offset, 
final int remaining,
 
  300                                 final int[] offset_post, 
final List<Attribute> attributes)
 
  301            throws IndexOutOfBoundsException, IllegalArgumentException
 
  303        Bitstream.checkBounds(in, 
offset, remaining);
 
  307        final int i_sTag = in[i++];
 
  310            throw new IllegalArgumentException(
"ShArmAttr: Invalid Sub-Section tag (NaT): "+i_sTag);
 
  317                subSecLen = readUInt32(isBigEndian, in, i);
 
  321                throw new IllegalArgumentException(
"ShArmAttr: Invalid Sub-Section tag: "+sTag);
 
  324            while( i < 
offset + subSecLen ) {
 
  325                final int i_tag = in[i++];
 
  328                    throw new IllegalArgumentException(
"ShArmAttr: Invalid Attribute tag (NaT): "+i_tag);
 
  333                            final int[] i_post = 
new int[] { 0 };
 
  334                            final String value = getString(in, i, subSecLen + 
offset - i, i_post);
 
  335                            attributes.add(
new Attribute(tag, value));
 
  341                            final byte value = in[i++];
 
  342                            attributes.add( 
new Attribute( tag, Byte.valueOf(value) ) );
 
  346                        throw new IllegalArgumentException(
"ShArmAttr: Invalid Attribute tag: "+tag);
 
  350        offset_post[0] = 
offset + subSecLen;