1 9 package com.vladium.jcd.cls.attribute; 10 11 import java.io.IOException ; 12 13 import com.vladium.jcd.lib.UDataInputStream; 14 import com.vladium.jcd.lib.UDataOutputStream; 15 16 44 public 45 final class ExceptionsAttribute_info extends Attribute_info 46 { 47 49 51 public ExceptionsAttribute_info (final int attribute_name_index, 52 final IDeclaredExceptionTable exceptions) 53 { 54 super (attribute_name_index, exceptions.length ()); 55 56 m_exceptions = exceptions; 57 } 58 59 public IDeclaredExceptionTable getDeclaredExceptions () 60 { 61 return m_exceptions; 62 } 63 64 public long length () 65 { 66 return 6 + m_exceptions.length (); 67 } 68 69 71 public void accept (final IAttributeVisitor visitor, final Object ctx) 72 { 73 visitor.visit (this, ctx); 74 } 75 76 public String toString () 77 { 78 return "ExceptionsAttribute_info: [attribute_name_index = " + m_name_index + ", attribute_length = " + m_attribute_length + ']'; 80 } 81 82 84 87 public Object clone () 88 { 89 final ExceptionsAttribute_info _clone = (ExceptionsAttribute_info) super.clone (); 90 91 _clone.m_exceptions = (IDeclaredExceptionTable) m_exceptions.clone (); 93 94 return _clone; 95 } 96 97 99 public void writeInClassFormat (final UDataOutputStream out) throws IOException 100 { 101 super.writeInClassFormat (out); 102 103 m_exceptions.writeInClassFormat (out); 104 } 105 106 108 110 111 112 ExceptionsAttribute_info (final int attribute_name_index, final long attribute_length, 113 final UDataInputStream bytes) 114 throws IOException 115 { 116 super (attribute_name_index, attribute_length); 117 118 final int number_of_exceptions = bytes.readU2 (); 119 m_exceptions = new DeclaredExceptionTable (number_of_exceptions); 120 121 for (int i = 0; i < number_of_exceptions; i++) 122 { 123 final int exception_index = bytes.readU2 (); 124 125 m_exceptions.add (exception_index); 126 } 127 } 128 129 131 132 private IDeclaredExceptionTable m_exceptions; 133 134 } | Popular Tags |