com.sun.tools.javac.jvm
Class ClassFile

java.lang.Object
  extended by com.sun.tools.javac.jvm.ClassFile
Direct Known Subclasses:
ClassReader, ClassWriter

public class ClassFile
extends java.lang.Object

A JVM class file.

Generic Java classfiles have one additional attribute for classes, methods and fields:

   "Signature" (u4 attr-length, u2 signature-index)
  

A signature gives the full Java type of a method or field. When used as a class attribute, it indicates type parameters, followed by supertype, followed by all interfaces.

     methodOrFieldSignature ::= type
     classSignature         ::= [ typeparams ] supertype { interfacetype }
  

The type syntax in signatures is extended as follows:

     type       ::= ... | classtype | methodtype | typevar
     classtype  ::= classsig { '.' classsig }
     classig    ::= 'L' name [typeargs] ';'
     methodtype ::= [ typeparams ] '(' { type } ')' type
     typevar    ::= 'T' name ';'
     typeargs   ::= '<' type { type } '>'
     typeparams ::= '<' typeparam { typeparam } '>'
     typeparam  ::= name ':' type
  

This class defines constants used in class files as well as routines to convert between internal ``.'' and external ``/'' separators in class names.

This is NOT part of any API supported by Sun Microsystems. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.


Nested Class Summary
static class ClassFile.NameAndType
          A class for the name-and-type signature of a method or field.
 
Field Summary
static int CONSTANT_Class
           
static int CONSTANT_Double
           
static int CONSTANT_Fieldref
           
static int CONSTANT_Float
           
static int CONSTANT_Integer
           
static int CONSTANT_InterfaceMethodref
           
static int CONSTANT_Long
           
static int CONSTANT_Methodref
           
static int CONSTANT_NameandType
           
static int CONSTANT_String
           
static int CONSTANT_Unicode
           
static int CONSTANT_Utf8
           
static int JAVA_MAGIC
           
static int MAX_CODE
           
static int MAX_DIMENSIONS
           
static int MAX_LOCALS
           
static int MAX_PARAMETERS
           
static int MAX_STACK
           
 
Constructor Summary
ClassFile()
           
 
Method Summary
static byte[] externalize(byte[] buf, int offset, int len)
          Return external representation of buf[offset..offset+len-1], converting '.' to '/'.
static byte[] externalize(Name name)
          Return external representation of given name, converting '/' to '.'.
static byte[] internalize(byte[] buf, int offset, int len)
          Return internal representation of buf[offset..offset+len-1], converting '/' to '.'.
static byte[] internalize(Name name)
          Return internal representation of given name, converting '/' to '.'.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JAVA_MAGIC

public static final int JAVA_MAGIC
See Also:
Constant Field Values

CONSTANT_Utf8

public static final int CONSTANT_Utf8
See Also:
Constant Field Values

CONSTANT_Unicode

public static final int CONSTANT_Unicode
See Also:
Constant Field Values

CONSTANT_Integer

public static final int CONSTANT_Integer
See Also:
Constant Field Values

CONSTANT_Float

public static final int CONSTANT_Float
See Also:
Constant Field Values

CONSTANT_Long

public static final int CONSTANT_Long
See Also:
Constant Field Values

CONSTANT_Double

public static final int CONSTANT_Double
See Also:
Constant Field Values

CONSTANT_Class

public static final int CONSTANT_Class
See Also:
Constant Field Values

CONSTANT_String

public static final int CONSTANT_String
See Also:
Constant Field Values

CONSTANT_Fieldref

public static final int CONSTANT_Fieldref
See Also:
Constant Field Values

CONSTANT_Methodref

public static final int CONSTANT_Methodref
See Also:
Constant Field Values

CONSTANT_InterfaceMethodref

public static final int CONSTANT_InterfaceMethodref
See Also:
Constant Field Values

CONSTANT_NameandType

public static final int CONSTANT_NameandType
See Also:
Constant Field Values

MAX_PARAMETERS

public static final int MAX_PARAMETERS
See Also:
Constant Field Values

MAX_DIMENSIONS

public static final int MAX_DIMENSIONS
See Also:
Constant Field Values

MAX_CODE

public static final int MAX_CODE
See Also:
Constant Field Values

MAX_LOCALS

public static final int MAX_LOCALS
See Also:
Constant Field Values

MAX_STACK

public static final int MAX_STACK
See Also:
Constant Field Values
Constructor Detail

ClassFile

public ClassFile()
Method Detail

internalize

public static byte[] internalize(byte[] buf,
                                 int offset,
                                 int len)
Return internal representation of buf[offset..offset+len-1], converting '/' to '.'.


internalize

public static byte[] internalize(Name name)
Return internal representation of given name, converting '/' to '.'.


externalize

public static byte[] externalize(byte[] buf,
                                 int offset,
                                 int len)
Return external representation of buf[offset..offset+len-1], converting '.' to '/'.


externalize

public static byte[] externalize(Name name)
Return external representation of given name, converting '/' to '.'.