01: /* ===========================================================================
02: * $RCSfile: AnnotationDefaultAttrInfo.java,v $
03: * ===========================================================================
04: *
05: * RetroGuard -- an obfuscation package for Java classfiles.
06: *
07: * Copyright (c) 1998-2006 Mark Welsh (markw@retrologic.com)
08: *
09: * This program can be redistributed and/or modified under the terms of the
10: * Version 2 of the GNU General Public License as published by the Free
11: * Software Foundation.
12: *
13: * This program is distributed in the hope that it will be useful,
14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16: * GNU General Public License for more details.
17: *
18: */
19:
20: package COM.rl.obf.classfile;
21:
22: import java.io.*;
23: import java.util.*;
24:
25: /**
26: * Representation of an attribute.
27: *
28: * @author Mark Welsh
29: */
30: public class AnnotationDefaultAttrInfo extends AttrInfo {
31: // Constants -------------------------------------------------------------
32:
33: // Fields ----------------------------------------------------------------
34: private MemberValueInfo defaultValue;
35:
36: // Class Methods ---------------------------------------------------------
37:
38: // Instance Methods ------------------------------------------------------
39: protected AnnotationDefaultAttrInfo(ClassFile cf,
40: int attrNameIndex, int attrLength) {
41: super (cf, attrNameIndex, attrLength);
42: }
43:
44: /** Return the String name of the attribute. */
45: protected String getAttrName() throws Exception {
46: return ATTR_AnnotationDefault;
47: }
48:
49: /** Return the default value. */
50: protected MemberValueInfo getDefaultValue() throws Exception {
51: return defaultValue;
52: }
53:
54: /** Check for Utf8 references in the 'info' data to the constant pool and mark them. */
55: protected void markUtf8RefsInInfo(ConstantPool pool)
56: throws Exception {
57: defaultValue.markUtf8Refs(pool);
58: }
59:
60: /** Read the data following the header. */
61: protected void readInfo(DataInput din) throws Exception {
62: defaultValue = MemberValueInfo.create(din);
63: }
64:
65: /** Export data following the header to a DataOutput stream. */
66: public void writeInfo(DataOutput dout) throws Exception {
67: defaultValue.write(dout);
68: }
69:
70: /** Do necessary name remapping. */
71: protected void remap(ClassFile cf, NameMapper nm) throws Exception {
72: defaultValue.remap(cf, nm);
73: }
74: }
|