private boolean constantPoolStringEquals ( final int cpIdx , final String asciiString ) throws ClassfileFormatException , IOException { final int strOffset = getConstantPoolStringOffset ( cpIdx , /* subFieldIdx = */ 0 ) ; if ( strOffset == 0 ) { return asciiString == null ; } else if ( asciiString == null ) { return false ; } final int strLen = inputStreamOrByteBuffer . readUnsignedShort ( strOffset ) ; final int otherLen = asciiString . length ( ) ; if ( strLen != otherLen ) { return false ; } final int strStart = strOffset + 2 ; for ( int i = 0 ; i < strLen ; i ++ ) { if ( ( char ) ( inputStreamOrByteBuffer . buf [ strStart + i ] & 0xff ) != asciiString . charAt ( i ) ) { return false ; } } return true ; }
Compare a string in the constant pool with a given ASCII string without constructing the constant pool String object .