KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > yworks > yguard > obf > classfile > ElementValuePairInfo


1 /*
2  * ElementValueInfo.java
3  *
4  * Created on April 20, 2005, 4:19 PM
5  */

6
7 package com.yworks.yguard.obf.classfile;
8
9 import com.yworks.yguard.ParseException;
10 import java.io.DataInput JavaDoc;
11 import java.io.DataOutput JavaDoc;
12 import java.io.IOException JavaDoc;
13
14 public class ElementValuePairInfo
15 {
16   protected int u2ElementNameIndex;
17   protected ElementValueInfo elementValue;
18   
19   private ElementValuePairInfo()
20   {}
21   
22   public static ElementValuePairInfo create(DataInput JavaDoc din) throws IOException JavaDoc
23   {
24     ElementValuePairInfo evp = new ElementValuePairInfo();
25     evp.read(din);
26     return evp;
27   }
28   
29   protected void read(DataInput JavaDoc din) throws java.io.IOException JavaDoc
30   {
31     u2ElementNameIndex = din.readUnsignedShort();
32     elementValue = ElementValueInfo.create(din);
33   }
34
35   protected void markUtf8RefsInInfo(ConstantPool pool) {
36     pool.getCpEntry(u2ElementNameIndex).incRefCount();
37     elementValue.markUtf8RefsInInfo(pool);
38   }
39   
40   /** Export the representation to a DataOutput stream. */
41   public void write(DataOutput JavaDoc dout) throws java.io.IOException JavaDoc
42   {
43     dout.writeShort(u2ElementNameIndex);
44     elementValue.write(dout);
45   }
46 }
47
Popular Tags