APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.bcel.internal.classfile

public final Class ModulePackages

extends Attribute
Class Inheritance
Imports
java.io.DataInput, .DataOutputStream, .IOException, java.util.Arrays, com.sun.org.apache.bcel.internal.Const, com.sun.org.apache.bcel.internal.util.Args, jdk.xml.internal.Utils

This class is derived from Attribute and represents the list of packages that are exported or opened by the Module attribute. There may be at most one ModulePackages attribute in a ClassFile structure.
See Also
Attribute

Field Summary

Modifier and TypeField and Description
private int[]
Inherited from com.sun.org.apache.bcel.internal.classfile.Attribute:
constant_poolEMPTY_ARRAYlengthname_indextag

Constructor Summary

AccessConstructor and Description
pack-priv
ModulePackages(final int
Index in constant pool
nameIndex
,
final int
Content length in bytes
length
,
final DataInput
Input stream
input
,
final ConstantPool
Array of constants
constantPool
)

Constructs object from input stream.

public
ModulePackages(final int
Index in constant pool
nameIndex
,
final int
Content length in bytes
length
,
final int[]
Table of indices in constant pool
packageIndexTable
,
final ConstantPool
Array of constants
constantPool
)

public
ModulePackages(final ModulePackages
Source to copy.
c
)

Initialize from another object.

Method Summary

Modifier and TypeMethod and Description
public void
accept(final Visitor
Visitor object
v
)

Implements abstract com.sun.org.apache.bcel.internal.classfile.Attribute.accept.

Implements com.sun.org.apache.bcel.internal.classfile.Node.accept.

Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class.

public Attribute
copy(final ConstantPool constantPool)

Implements abstract com.sun.org.apache.bcel.internal.classfile.Attribute.copy.

Returns: deep copy of this attribute

public void
dump(final DataOutputStream
Output file stream
file
)

Overrides com.sun.org.apache.bcel.internal.classfile.Attribute.dump.

Dump ModulePackages attribute to file stream in binary format.

public int
getNumberOfPackages()

Returns: Length of package table.

public int[]
getPackageIndexTable()

Returns: array of indices into constant pool of package names.

public String[]
getPackageNames()

Returns: string array of package names

public void
setPackageIndexTable(final int[]
the list of package indexes Also redefines number_of_packages according to table length.
packageIndexTable
)

public String

Returns:

String representation, i.e., a list of packages.
toString
()

Overrides com.sun.org.apache.bcel.internal.classfile.Attribute.toString.

Returns a string representation of the object.

Inherited from com.sun.org.apache.bcel.internal.classfile.Attribute:
addAttributeReaderclonegetConstantPoolgetLengthgetNamegetNameIndexgetTagprintlnreadAttributereadAttributeremoveAttributeReadersetConstantPoolsetLengthsetNameIndex

Field Detail

packageIndexTableback to summary
private int[] packageIndexTable

Constructor Detail

ModulePackagesback to summary
pack-priv ModulePackages(final int nameIndex, final int length, final DataInput input, final ConstantPool constantPool) throws IOException

Constructs object from input stream.

Parameters
nameIndex:int

Index in constant pool

length:int

Content length in bytes

input:DataInput

Input stream

constantPool:ConstantPool

Array of constants

Exceptions
IOException:
if an I/O error occurs.
ModulePackagesback to summary
public ModulePackages(final int nameIndex, final int length, final int[] packageIndexTable, final ConstantPool constantPool)
Parameters
nameIndex:int

Index in constant pool

length:int

Content length in bytes

packageIndexTable:int[]

Table of indices in constant pool

constantPool:ConstantPool

Array of constants

ModulePackagesback to summary
public ModulePackages(final ModulePackages c)

Initialize from another object. Note that both objects use the same references (shallow copy). Use copy() for a physical copy.

Parameters
c:ModulePackages

Source to copy.

Method Detail

acceptback to summary
public void accept(final Visitor v)

Implements abstract com.sun.org.apache.bcel.internal.classfile.Attribute.accept.

Implements com.sun.org.apache.bcel.internal.classfile.Node.accept.

Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class. I.e., the hierarchy of methods, fields, attributes, etc. spawns a tree of objects.

Parameters
v:Visitor

Visitor object

Annotations
@Override
copyback to summary
public Attribute copy(final ConstantPool constantPool)

Implements abstract com.sun.org.apache.bcel.internal.classfile.Attribute.copy.

Returns:Attribute

deep copy of this attribute

Annotations
@Override
dumpback to summary
public void dump(final DataOutputStream file) throws IOException

Overrides com.sun.org.apache.bcel.internal.classfile.Attribute.dump.

Dump ModulePackages attribute to file stream in binary format.

Parameters
file:DataOutputStream

Output file stream

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
getNumberOfPackagesback to summary
public int getNumberOfPackages()
Returns:int

Length of package table.

getPackageIndexTableback to summary
public int[] getPackageIndexTable()
Returns:int[]

array of indices into constant pool of package names.

getPackageNamesback to summary
public String[] getPackageNames()
Returns:String[]

string array of package names

setPackageIndexTableback to summary
public void setPackageIndexTable(final int[] packageIndexTable)
Parameters
packageIndexTable:int[]

the list of package indexes Also redefines number_of_packages according to table length.

toStringback to summary
public String toString()

Overrides com.sun.org.apache.bcel.internal.classfile.Attribute.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

String representation, i.e., a list of packages.

Annotations
@Override