01: /*
02: * ElementValueInfo.java
03: *
04: * Created on April 20, 2005, 4:19 PM
05: */
06:
07: package com.yworks.yguard.obf.classfile;
08:
09: import com.yworks.yguard.ParseException;
10: import java.io.DataInput;
11: import java.io.DataOutput;
12: import java.io.IOException;
13:
14: public class ElementValuePairInfo {
15: protected int u2ElementNameIndex;
16: protected ElementValueInfo elementValue;
17:
18: private ElementValuePairInfo() {
19: }
20:
21: public static ElementValuePairInfo create(DataInput din)
22: throws IOException {
23: ElementValuePairInfo evp = new ElementValuePairInfo();
24: evp.read(din);
25: return evp;
26: }
27:
28: protected void read(DataInput din) throws java.io.IOException {
29: u2ElementNameIndex = din.readUnsignedShort();
30: elementValue = ElementValueInfo.create(din);
31: }
32:
33: protected void markUtf8RefsInInfo(ConstantPool pool) {
34: pool.getCpEntry(u2ElementNameIndex).incRefCount();
35: elementValue.markUtf8RefsInInfo(pool);
36: }
37:
38: /** Export the representation to a DataOutput stream. */
39: public void write(DataOutput dout) throws java.io.IOException {
40: dout.writeShort(u2ElementNameIndex);
41: elementValue.write(dout);
42: }
43: }
|