com.android.dx.cf.code
Class ByteCatchList

java.lang.Object
  extended by com.android.dx.util.MutabilityControl
      extended by com.android.dx.util.FixedSizeList
          extended by com.android.dx.cf.code.ByteCatchList
All Implemented Interfaces:
ToHuman

public final class ByteCatchList
extends FixedSizeList

List of catch entries, that is, the elements of an "exception table," which is part of a standard Code attribute.


Nested Class Summary
static class ByteCatchList.Item
          Item in an exception handler list.
 
Field Summary
static ByteCatchList EMPTY
          non-null; convenient zero-entry instance
 
Constructor Summary
ByteCatchList(int count)
          Constructs an instance.
 
Method Summary
 int byteLength()
          Gets the total length of this structure in bytes, when included in a Code attribute.
 ByteCatchList.Item get(int n)
          Gets the indicated item.
 ByteCatchList listFor(int pc)
          Gets the list of items active at the given address.
 void set(int n, ByteCatchList.Item item)
          Sets the item at the given index.
 void set(int n, int startPc, int endPc, int handlerPc, CstType exceptionClass)
          Sets the item at the given index.
 TypeList toRopCatchList()
          Returns a rop-style catches list equivalent to this one.
 IntList toTargetList(int noException)
          Returns a target list corresponding to this instance.
 
Methods inherited from class com.android.dx.util.FixedSizeList
equals, get0, getOrNull0, hashCode, set0, shrinkToFit, size, toHuman, toHuman, toString, toString
 
Methods inherited from class com.android.dx.util.MutabilityControl
isImmutable, isMutable, setImmutable, throwIfImmutable, throwIfMutable
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY

public static final ByteCatchList EMPTY
non-null; convenient zero-entry instance

Constructor Detail

ByteCatchList

public ByteCatchList(int count)
Constructs an instance.

Parameters:
count - the number of elements to be in the table
Method Detail

byteLength

public int byteLength()
Gets the total length of this structure in bytes, when included in a Code attribute. The returned value includes the two bytes for exception_table_length.

Returns:
>= 2; the total length, in bytes

get

public ByteCatchList.Item get(int n)
Gets the indicated item.

Parameters:
n - >= 0; which item
Returns:
null-ok; the indicated item

set

public void set(int n,
                ByteCatchList.Item item)
Sets the item at the given index.

Parameters:
n - >= 0, < size(); which entry to set
item - non-null; the item

set

public void set(int n,
                int startPc,
                int endPc,
                int handlerPc,
                CstType exceptionClass)
Sets the item at the given index.

Parameters:
n - >= 0, < size(); which entry to set
startPc - >= 0; the start pc (inclusive) of the handler's range
endPc - >= startPc; the end pc (exclusive) of the handler's range
handlerPc - >= 0; the pc of the exception handler
exceptionClass - null-ok; the exception class or null to catch all exceptions with this handler

listFor

public ByteCatchList listFor(int pc)
Gets the list of items active at the given address. The result is automatically made immutable.

Parameters:
pc - which address
Returns:
non-null; list of exception handlers active at pc

toTargetList

public IntList toTargetList(int noException)
Returns a target list corresponding to this instance. The result is a list of all the exception handler addresses, with the given noException address appended if appropriate. The result is automatically made immutable.

Parameters:
noException - >= -1; the no-exception address to append, or -1 not to append anything
Returns:
non-null; list of exception targets, with noException appended if necessary

toRopCatchList

public TypeList toRopCatchList()
Returns a rop-style catches list equivalent to this one.

Returns:
non-null; the converted instance


Copyright © 2015. All rights reserved.