• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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: InnerClass_info.java,v 1.1.1.1 2004/05/09 16:57:48 vlad_r Exp $
8  */
9 package com.vladium.jcd.cls.attribute;
10 
11 import java.io.IOException;
12 
13 import com.vladium.jcd.compiler.IClassFormatOutput;
14 import com.vladium.jcd.lib.UDataInputStream;
15 import com.vladium.jcd.lib.UDataOutputStream;
16 
17 // ----------------------------------------------------------------------------
18 /**
19  * @author Vlad Roubtsov, (C) 2003
20  */
21 public
22 final class InnerClass_info implements Cloneable, IClassFormatOutput
23 {
24     // public: ................................................................
25 
26     public int m_outer_class_index, m_inner_class_index;
27     public int m_inner_name_index;
28     public int m_inner_access_flags;
29 
30 
InnerClass_info(final int outer_class_index, final int inner_class_index, final int inner_name_index, final int inner_access_flags)31     public InnerClass_info (final int outer_class_index, final int inner_class_index,
32                             final int inner_name_index, final int inner_access_flags)
33     {
34         m_outer_class_index = outer_class_index;
35         m_inner_class_index = inner_class_index;
36         m_inner_name_index = inner_name_index;
37         m_inner_access_flags = inner_access_flags;
38     }
39 
40 
toString()41     public String toString ()
42     {
43         return "innerclass_info: [m_outer_class_index = " + m_outer_class_index + ", m_inner_class_index = " + m_inner_class_index +
44             ", m_inner_name_index = " + m_inner_name_index + ", m_inner_access_flags = " + m_inner_access_flags + "]";
45     }
46 
47     // Cloneable:
48 
49     /**
50      * Performs a deep copy.
51      */
clone()52     public Object clone ()
53     {
54         try
55         {
56             return super.clone ();
57         }
58         catch (CloneNotSupportedException e)
59         {
60             throw new InternalError (e.toString ());
61         }
62     }
63 
64     // IClassFormatOutput:
65 
writeInClassFormat(final UDataOutputStream out)66     public void writeInClassFormat (final UDataOutputStream out) throws IOException
67     {
68         out.writeU2 (m_inner_class_index);
69         out.writeU2 (m_outer_class_index);
70         out.writeU2 (m_inner_name_index);
71         out.writeU2 (m_inner_access_flags);
72     }
73 
74     // protected: .............................................................
75 
76     // package: ...............................................................
77 
78 
InnerClass_info(final UDataInputStream bytes)79     InnerClass_info (final UDataInputStream bytes) throws IOException
80     {
81         m_inner_class_index = bytes.readU2 ();
82         m_outer_class_index = bytes.readU2 ();
83         m_inner_name_index = bytes.readU2 ();
84         m_inner_access_flags = bytes.readU2 ();
85     }
86 
87     // private: ...............................................................
88 
89 } // end of class
90 // ----------------------------------------------------------------------------