private String stringAt ( int index ) { // Determine the offset from the start of the string pool. int offset = m_stringOffsets [ index ] ; // For convenience, wrap the string pool in ByteBuffer // so that it will handle advancing the buffer index. ByteBuffer buffer = ByteBuffer . wrap ( m_stringPool , offset , m_stringPool . length - offset ) . order ( ByteOrder . BIG_ENDIAN ) ; // Now get the decoded string length. int length = decodeLength ( buffer ) ; StringBuilder stringBuilder = new StringBuilder ( ) ; for ( int i = 0 ; i < length ; i ++ ) { if ( m_isUtf8 ) { stringBuilder . append ( ( char ) buffer . get ( ) ) ; } else { int byte1 = buffer . get ( ) ; int byte2 = buffer . get ( ) ; stringBuilder . append ( ( char ) ( byte2 | byte1 ) ) ; } } return stringBuilder . toString ( ) ; }
Extracts a string from the string pool at the given index .