public static String getConstantString ( ConstantPool pool , int index ) { Constant c = pool . getConstant ( index ) ; assert c != null : "Bad index " + index + " into pool" ; if ( c instanceof ConstantUtf8 ) { return ( ( ConstantUtf8 ) c ) . getBytes ( ) ; } else if ( c instanceof ConstantClass ) { ConstantClass cc = ( ConstantClass ) c ; return cc . getBytes ( pool ) + " [" + cc . getNameIndex ( ) + "]" ; } else { throw new Error ( "unexpected constant " + c + " of class " + c . getClass ( ) ) ; } }
Returns the constant string at the specified offset .