com.vladium.jcd.cls.attribute
Class ExceptionHandlerTable

java.lang.Object
  extended by com.vladium.jcd.cls.attribute.ExceptionHandlerTable
All Implemented Interfaces:
IExceptionHandlerTable, IClassFormatOutput, java.lang.Cloneable

final class ExceptionHandlerTable
extends java.lang.Object
implements IExceptionHandlerTable

Author:
(C) 2001, Vlad Roubtsov

Field Summary
private  java.util.List m_exceptions
           
 
Constructor Summary
ExceptionHandlerTable(int capacity)
           
 
Method Summary
 int add(Exception_info exception)
          Adds a new Exception_info descriptor to this collection.
 java.lang.Object clone()
          Performs a deep copy.
 Exception_info get(int offset)
          Returns Exception_info descriptor at a given offset.
 long length()
          Returns the total length of this table when converted to .class format [including 2 count bytes]
 Exception_info set(int offset, Exception_info exception)
          Replaces the Exception_info descriptor at a given offset.
 int size()
          Returns the number of descriptors in this collection [can be 0].
 void writeInClassFormat(UDataOutputStream out)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_exceptions

private java.util.List m_exceptions
Constructor Detail

ExceptionHandlerTable

ExceptionHandlerTable(int capacity)
Method Detail

get

public Exception_info get(int offset)
Description copied from interface: IExceptionHandlerTable
Returns Exception_info descriptor at a given offset.

Specified by:
get in interface IExceptionHandlerTable
Parameters:
offset - exception offset [must be in [0, size()) range; input not checked]
Returns:
Exception_info descriptor [never null]

size

public int size()
Description copied from interface: IExceptionHandlerTable
Returns the number of descriptors in this collection [can be 0].

Specified by:
size in interface IExceptionHandlerTable

length

public long length()
Description copied from interface: IExceptionHandlerTable
Returns the total length of this table when converted to .class format [including 2 count bytes]

Specified by:
length in interface IExceptionHandlerTable

clone

public java.lang.Object clone()
Performs a deep copy.

Specified by:
clone in interface IExceptionHandlerTable
Overrides:
clone in class java.lang.Object

writeInClassFormat

public void writeInClassFormat(UDataOutputStream out)
                        throws java.io.IOException
Specified by:
writeInClassFormat in interface IClassFormatOutput
Throws:
java.io.IOException

add

public int add(Exception_info exception)
Description copied from interface: IExceptionHandlerTable
Adds a new Exception_info descriptor to this collection. No duplicate checks are made. It is the responsibility of the caller to ensure that all data referenced in 'exception' will eventually be consistent with method's bytecode and the class's constant pool.

Specified by:
add in interface IExceptionHandlerTable
Parameters:
exception - new exception descriptor [may not be null]

set

public Exception_info set(int offset,
                          Exception_info exception)
Description copied from interface: IExceptionHandlerTable
Replaces the Exception_info descriptor at a given offset. No duplicate checks are made. No exception type compatibility checks are made. It is the responsibility of the caller to ensure that all data referenced in 'exception' will eventually be consistent with method's bytecode and the class's constant pool.

Specified by:
set in interface IExceptionHandlerTable
Parameters:
offset - exception offset [must be in [0, size()) range; input not checked]
exception - new exception descriptor [may not be null]
Returns:
previous exception descriptor at this offset [never null]