FileDocCategorySizeDatePackage
CodeException.javaAPI DocJava SE 5 API7548Fri Aug 26 14:55:16 BST 2005com.sun.org.apache.bcel.internal.classfile

CodeException

public final class CodeException extends Object implements Node, com.sun.org.apache.bcel.internal.Constants, Cloneable
This class represents an entry in the exception table of the Code attribute and is used only there. It contains a range in which a particular exception handler is active.
version
$Id: CodeException.java,v 1.1.1.1 2001/10/29 19:59:58 jvanzyl Exp $
author
M. Dahm
see
Code

Fields Summary
private int
start_pc
private int
end_pc
private int
handler_pc
private int
catch_type
Constructors Summary
public CodeException(CodeException c)
Initialize from another object.

    this(c.getStartPC(), c.getEndPC(), c.getHandlerPC(), c.getCatchType());
  
CodeException(DataInputStream file)
Construct object from file stream.

param
file Input stream
throw
IOException

    this(file.readUnsignedShort(), file.readUnsignedShort(),
	 file.readUnsignedShort(), file.readUnsignedShort());
  
public CodeException(int start_pc, int end_pc, int handler_pc, int catch_type)

param
start_pc Range in the code the exception handler is active, start_pc is inclusive while
param
end_pc is exclusive
param
handler_pc Starting address of exception handler, i.e., an offset from start of code.
param
catch_type If zero the handler catches any exception, otherwise it points to the exception class which is to be caught.

    this.start_pc   = start_pc;
    this.end_pc     = end_pc;
    this.handler_pc = handler_pc;
    this.catch_type = catch_type;
  
Methods Summary
public voidaccept(com.sun.org.apache.bcel.internal.classfile.Visitor v)
Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. I.e., the hierarchy of methods, fields, attributes, etc. spawns a tree of objects.

param
v Visitor object

    v.visitCodeException(this);
  
public com.sun.org.apache.bcel.internal.classfile.CodeExceptioncopy()

return
deep copy of this object

    try {
      return (CodeException)clone();
    } catch(CloneNotSupportedException e) {}

    return null;
  
public final voiddump(java.io.DataOutputStream file)
Dump code exception to file stream in binary format.

param
file Output file stream
throw
IOException

    file.writeShort(start_pc);
    file.writeShort(end_pc);
    file.writeShort(handler_pc);
    file.writeShort(catch_type);
  
public final intgetCatchType()

return
0, if the handler catches any exception, otherwise it points to the exception class which is to be caught.

 return catch_type; 
public final intgetEndPC()

return
Exclusive end index of the region where the handler is active.

 return end_pc; 
public final intgetHandlerPC()

return
Starting address of exception handler, relative to the code.

 return handler_pc; 
public final intgetStartPC()

return
Inclusive start index of the region where the handler is active.

 return start_pc; 
public final voidsetCatchType(int catch_type)

param
catch_type.

    this.catch_type = catch_type;
  
public final voidsetEndPC(int end_pc)

param
end_pc end of handled block

    this.end_pc = end_pc;
  
public final voidsetHandlerPC(int handler_pc)

param
handler_pc where the actual code is

    this.handler_pc = handler_pc;
  
public final voidsetStartPC(int start_pc)

param
start_pc start of handled block

    this.start_pc = start_pc;
  
public final java.lang.StringtoString()

return
String representation.

    return "CodeException(start_pc = " + start_pc + 
      ", end_pc = " + end_pc +
      ", handler_pc = " + handler_pc + ", catch_type = " + catch_type + ")";
  
public final java.lang.StringtoString(com.sun.org.apache.bcel.internal.classfile.ConstantPool cp, boolean verbose)

return
String representation.

    String str;

    if(catch_type == 0)
      str = "<Any exception>(0)";
    else
      str = Utility.compactClassName(cp.getConstantString(catch_type, CONSTANT_Class), false) +
	(verbose? "(" + catch_type + ")" : "");

    return start_pc + "\t" + end_pc + "\t" + handler_pc + "\t" + str;
  
public final java.lang.StringtoString(com.sun.org.apache.bcel.internal.classfile.ConstantPool cp)

    return toString(cp, true);