| 1 6 7 package com.yworks.yguard.obf.classfile; 8 9 import java.io.DataInput ; 10 import java.io.DataOutput ; 11 12 public class AnnotationInfo 13 { 14 16 17 protected int u2typeIndex; 19 private int u2elementCount; 20 private ElementValuePairInfo[] elementValuePairs; 21 22 23 public static AnnotationInfo create(DataInput din) throws java.io.IOException  25 { 26 if (din == null) throw new NullPointerException ("DataInput cannot be null!"); 27 AnnotationInfo an = new AnnotationInfo(); 28 an.read(din); 29 return an; 30 } 31 32 protected ElementValuePairInfo[] getElementValuePairs(){ 33 return elementValuePairs; 34 } 35 36 private AnnotationInfo() 38 {} 39 40 protected void markUtf8RefsInInfo(ConstantPool pool) { 41 pool.getCpEntry(u2typeIndex).incRefCount(); 42 for (int i = 0; i < u2elementCount; i++){ 43 elementValuePairs[i].markUtf8RefsInInfo(pool); 44 } 45 } 46 47 private void read(DataInput din) throws java.io.IOException  48 { 49 u2typeIndex = din.readUnsignedShort(); 50 u2elementCount = din.readUnsignedShort(); 51 elementValuePairs = new ElementValuePairInfo[u2elementCount]; 52 for (int i = 0; i < u2elementCount; i++) 53 { 54 elementValuePairs[i] = ElementValuePairInfo.create(din); 55 } 56 } 57 58 59 public void write(DataOutput dout) throws java.io.IOException  60 { 61 dout.writeShort(u2typeIndex); 62 dout.writeShort(u2elementCount); 63 for (int i = 0; i < u2elementCount; i++) 64 { 65 elementValuePairs[i].write(dout); 66 } 67 } 68 } 69 | Popular Tags |