Top Description Fields Constructors Methods
javassist.bytecode

public Class ExceptionTable

Additional top-level class in compilation unit: ExceptionTableEntry.

extends Object
implements Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable
Imports
java.io.DataInputStream, .DataOutputStream, .IOException, java.util.ArrayList, .List, .Map

exception_table[] of Code_attribute.

Field Summary

Modifier and TypeField and Description
private ConstPool
private List<ExceptionTableEntry>

Constructor Summary

AccessConstructor and Description
public
ExceptionTable(ConstPool
constant pool table.
cp
)

Constructs an exception_table[].

pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
add(int
index (>= 0) at which the entry is to be inserted.
index
,
ExceptionTable table, int
the offset added to the code position.
offset
)

Copies the given exception table at the specified position in the table.

public void
add(int
index (>= 0) at which the entry is to be inserted.
index
,
int
startPc
start
,
int
endPc
end
,
int
handlerPc
handler
,
int
catchType
type
)

Adds a new entry at the specified position in the table.

public void
add(int
startPc
start
,
int
endPc
end
,
int
handlerPc
handler
,
int
catchType
type
)

Appends a new entry at the end of the table.

public int

Returns:

an index into the constant_pool table, or zero if this exception handler is for all exceptions.
catchType
(int
the n-th (>= 0).
nth
)

Returns catchType of the n-th entry.

public Object
clone()

Overrides java.lang.Object.clone.

Creates and returns a copy of this object.

public ExceptionTable
copy(ConstPool
the constant pool table used by the new copy.
newCp
,
Map<String, String>
pairs of replaced and substituted class names.
classnames
)

Makes a copy of this exception_table[].

public int
endPc(int
the n-th (>= 0).
nth
)

Returns endPc of the n-th entry.

public int
handlerPc(int
the n-th (>= 0).
nth
)

Returns handlerPc of the n-th entry.

public void
remove(int
the index of the removed entry.
index
)

Removes the entry at the specified position in the table.

public void
setCatchType(int
the n-th (>= 0).
nth
,
int
new value.
value
)

Sets catchType of the n-th entry.

public void
setEndPc(int
the n-th (>= 0).
nth
,
int
new value.
value
)

Sets endPc of the n-th entry.

public void
setHandlerPc(int
the n-th (>= 0).
nth
,
int
new value.
value
)

Sets handlerPc of the n-th entry.

public void
setStartPc(int
the n-th (>= 0).
nth
,
int
new value.
value
)

Sets startPc of the n-th entry.

pack-priv void
shiftPc(int where, int gapLength, boolean exclusive)

private static int
shiftPc(int pc, int where, int gapLength, boolean exclusive)

public int
size()

Returns exception_table_length, which is the number of entries in the exception_table[].

public int
startPc(int
the n-th (>= 0).
nth
)

Returns startPc of the n-th entry.

pack-priv void
Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

constPoolback to summary
private ConstPool constPool
entriesback to summary
private List<ExceptionTableEntry> entries

Constructor Detail

ExceptionTableback to summary
public ExceptionTable(ConstPool cp)

Constructs an exception_table[].

Parameters
cp:ConstPool

constant pool table.

ExceptionTableback to summary
pack-priv ExceptionTable(ConstPool cp, DataInputStream in) throws IOException

Method Detail

addback to summary
public void add(int index, ExceptionTable table, int offset)

Copies the given exception table at the specified position in the table.

Parameters
index:int

index (>= 0) at which the entry is to be inserted.

offset:int

the offset added to the code position.

addback to summary
public void add(int index, int start, int end, int handler, int type)

Adds a new entry at the specified position in the table.

Parameters
index:int

index (>= 0) at which the entry is to be inserted.

start:int

startPc

end:int

endPc

handler:int

handlerPc

type:int

catchType

addback to summary
public void add(int start, int end, int handler, int type)

Appends a new entry at the end of the table.

Parameters
start:int

startPc

end:int

endPc

handler:int

handlerPc

type:int

catchType

catchTypeback to summary
public int catchType(int nth)

Returns catchType of the n-th entry.

Parameters
nth:int

the n-th (>= 0).

Returns:int

an index into the constant_pool table, or zero if this exception handler is for all exceptions.

cloneback to summary
public Object clone() throws CloneNotSupportedException

Overrides java.lang.Object.clone.

Creates and returns a copy of this object. The constant pool object is shared between this object and the cloned object.

Returns:Object

Doc from java.lang.Object.clone.

a clone of this instance.

Annotations
@Override
Exceptions
CloneNotSupportedException:

Doc from java.lang.Object.clone.

if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned.

copyback to summary
public ExceptionTable copy(ConstPool newCp, Map<String, String> classnames)

Makes a copy of this exception_table[]. Class names are replaced according to the given Map object.

Parameters
newCp:ConstPool

the constant pool table used by the new copy.

classnames:Map<String, String>

pairs of replaced and substituted class names.

endPcback to summary
public int endPc(int nth)

Returns endPc of the n-th entry.

Parameters
nth:int

the n-th (>= 0).

handlerPcback to summary
public int handlerPc(int nth)

Returns handlerPc of the n-th entry.

Parameters
nth:int

the n-th (>= 0).

removeback to summary
public void remove(int index)

Removes the entry at the specified position in the table.

Parameters
index:int

the index of the removed entry.

setCatchTypeback to summary
public void setCatchType(int nth, int value)

Sets catchType of the n-th entry.

Parameters
nth:int

the n-th (>= 0).

value:int

new value.

setEndPcback to summary
public void setEndPc(int nth, int value)

Sets endPc of the n-th entry.

Parameters
nth:int

the n-th (>= 0).

value:int

new value.

setHandlerPcback to summary
public void setHandlerPc(int nth, int value)

Sets handlerPc of the n-th entry.

Parameters
nth:int

the n-th (>= 0).

value:int

new value.

setStartPcback to summary
public void setStartPc(int nth, int value)

Sets startPc of the n-th entry.

Parameters
nth:int

the n-th (>= 0).

value:int

new value.

shiftPcback to summary
pack-priv void shiftPc(int where, int gapLength, boolean exclusive)
shiftPcback to summary
private static int shiftPc(int pc, int where, int gapLength, boolean exclusive)
sizeback to summary
public int size()

Returns exception_table_length, which is the number of entries in the exception_table[].

startPcback to summary
public int startPc(int nth)

Returns startPc of the n-th entry.

Parameters
nth:int

the n-th (>= 0).

writeback to summary
pack-priv void write(DataOutputStream out) throws IOException