KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jas > ClassCP


1 /**
2  * This is used to create a Class constant pool item
3  *
4  * @author $Author: fqian $
5  * @version $Revision: 1.1 $
6  */

7
8 package jas;
9
10 import java.io.*;
11
12
13 public class ClassCP extends CP implements RuntimeConstants
14 {
15   AsciiCP name;
16
17   /**
18    * @param name Name of the class
19    */

20   public ClassCP(String JavaDoc name)
21   {
22     uniq = ("CLASS: #$%^#$" + name).intern();
23     this.name = new AsciiCP(name);
24   }
25
26   void resolve(ClassEnv e)
27   { e.addCPItem(name); }
28
29   void write(ClassEnv e, DataOutputStream out)
30     throws IOException, jasError
31   {
32     out.writeByte(CONSTANT_CLASS);
33     out.writeShort(e.getCPIndex(name));
34   }
35 }
36
Popular Tags