KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > vladium > jcd > cls > constant > CONSTANT_ref_info


1 /* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved.
2  *
3  * This program and the accompanying materials are made available under
4  * the terms of the Common Public License v1.0 which accompanies this distribution,
5  * and is available at http://www.eclipse.org/legal/cpl-v10.html
6  *
7  * $Id: CONSTANT_ref_info.java,v 1.1.1.1 2004/05/09 16:57:49 vlad_r Exp $
8  */

9 package com.vladium.jcd.cls.constant;
10
11 import java.io.IOException JavaDoc;
12
13 import com.vladium.jcd.lib.UDataInputStream;
14 import com.vladium.jcd.lib.UDataOutputStream;
15
16 // ----------------------------------------------------------------------------
17
/**
18  * Abstract base for all CONSTANT_XXXref_info structures. They all have a constant
19  * pool pointer to a {@link CONSTANT_Class_info} and {@link CONSTANT_NameAndType_info}
20  * entries.<P>
21  *
22  * The value of the class_index item must be a valid index into the constant pool
23  * table. The constant pool entry at that index must be a {@link CONSTANT_Class_info}
24  * structure representing the class or interface type that contains the declaration
25  * of the field or method.<P>
26  *
27  * The class_index item of a {@link CONSTANT_Fieldref_info} or a {@link CONSTANT_Methodref_info}
28  * structure must be a class type, not an interface type. The class_index item of
29  * a {@link CONSTANT_InterfaceMethodref_info} structure must be an interface type
30  * that declares the given method.
31  *
32  * @see CONSTANT_Fieldref_info
33  * @see CONSTANT_Methodref_info
34  * @see CONSTANT_InterfaceMethodref_info
35  *
36  * @author (C) 2001, Vlad Roubtsov
37  */

38 public
39 abstract class CONSTANT_ref_info extends CONSTANT_info
40 {
41     // public: ................................................................
42

43     
44     public int m_class_index;
45     public int m_name_and_type_index;
46     
47     // IClassFormatOutput:
48

49     public void writeInClassFormat (final UDataOutputStream out) throws IOException JavaDoc
50     {
51         super.writeInClassFormat (out);
52         
53         out.writeU2 (m_class_index);
54         out.writeU2 (m_name_and_type_index);
55     }
56     
57     // Cloneable: inherited clone() is Ok
58

59     // protected: .............................................................
60

61     
62     protected CONSTANT_ref_info (final UDataInputStream bytes)
63         throws IOException JavaDoc
64     {
65         m_class_index = bytes.readU2 ();
66         m_name_and_type_index = bytes.readU2 ();
67     }
68     
69     protected CONSTANT_ref_info (final int class_index, final int name_and_type_index)
70     {
71         m_class_index = class_index;
72         m_name_and_type_index = name_and_type_index;
73     }
74     
75     // package: ...............................................................
76

77     // private: ...............................................................
78

79 } // end of class
80
// ----------------------------------------------------------------------------
81
Popular Tags