javap/src/main/java/org/apidesign/javap/InnerClassData.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Thu, 07 Feb 2013 12:58:12 +0100
branchemul
changeset 694 0d277415ed02
parent 144 b06660b614db
permissions -rw-r--r--
Rebasing the Inflater support on jzlib which, unlike GNU ClassPath, has correct implementation of Huffman code. Making the implementation more easily testable by turning Inflater and ZipInputStream into pure delegates. Current implementation is going to need proper long support.
jtulach@144
     1
/*
jtulach@144
     2
 * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
jtulach@144
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jtulach@144
     4
 *
jtulach@144
     5
 * This code is free software; you can redistribute it and/or modify it
jtulach@144
     6
 * under the terms of the GNU General Public License version 2 only, as
jtulach@144
     7
 * published by the Free Software Foundation.  Oracle designates this
jtulach@144
     8
 * particular file as subject to the "Classpath" exception as provided
jtulach@144
     9
 * by Oracle in the LICENSE file that accompanied this code.
jtulach@144
    10
 *
jtulach@144
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
jtulach@144
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jtulach@144
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
jtulach@144
    14
 * version 2 for more details (a copy is included in the LICENSE file that
jtulach@144
    15
 * accompanied this code).
jtulach@144
    16
 *
jtulach@144
    17
 * You should have received a copy of the GNU General Public License version
jtulach@144
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
jtulach@144
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jtulach@144
    20
 *
jtulach@144
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
jtulach@144
    22
 * or visit www.oracle.com if you need additional information or have any
jtulach@144
    23
 * questions.
jtulach@144
    24
 */
jtulach@144
    25
jtulach@144
    26
jtulach@167
    27
package org.apidesign.javap;
jtulach@144
    28
jtulach@144
    29
import java.io.*;
jtulach@144
    30
import java.util.*;
jtulach@144
    31
jtulach@144
    32
/**
jtulach@144
    33
 * Strores InnerClass data informastion.
jtulach@144
    34
 *
jtulach@144
    35
 * @author  Sucheta Dambalkar (Adopted code from jdis)
jtulach@144
    36
 */
jtulach@144
    37
class InnerClassData  implements RuntimeConstants {
jtulach@144
    38
    ClassData cls;
jtulach@144
    39
jtulach@144
    40
jtulach@144
    41
    int inner_class_info_index
jtulach@144
    42
        ,outer_class_info_index
jtulach@144
    43
        ,inner_name_index
jtulach@144
    44
        ,access
jtulach@144
    45
        ;
jtulach@144
    46
jtulach@144
    47
    public InnerClassData(ClassData cls) {
jtulach@144
    48
        this.cls=cls;
jtulach@144
    49
jtulach@144
    50
    }
jtulach@144
    51
jtulach@144
    52
    /**
jtulach@144
    53
     * Read Innerclass attribute data.
jtulach@144
    54
     */
jtulach@144
    55
    public void read(DataInputStream in) throws IOException {
jtulach@144
    56
        inner_class_info_index = in.readUnsignedShort();
jtulach@144
    57
        outer_class_info_index = in.readUnsignedShort();
jtulach@144
    58
        inner_name_index = in.readUnsignedShort();
jtulach@144
    59
        access = in.readUnsignedShort();
jtulach@144
    60
    }  // end read
jtulach@144
    61
jtulach@144
    62
    /**
jtulach@144
    63
     * Returns the access of this class or interface.
jtulach@144
    64
     */
jtulach@144
    65
    public String[] getAccess(){
jtulach@144
    66
        Vector v = new Vector();
jtulach@144
    67
        if ((access & ACC_PUBLIC)   !=0) v.addElement("public");
jtulach@144
    68
        if ((access & ACC_FINAL)    !=0) v.addElement("final");
jtulach@144
    69
        if ((access & ACC_ABSTRACT) !=0) v.addElement("abstract");
jtulach@144
    70
        String[] accflags = new String[v.size()];
jtulach@144
    71
        v.copyInto(accflags);
jtulach@144
    72
        return accflags;
jtulach@144
    73
    }
jtulach@144
    74
jtulach@144
    75
} // end InnerClassData