private String findSearchStrings ( final int start ) { String longestMatch = null ; // Loop for each string for ( int i = 0 ; i < search . length ; i ++ ) { // No point checking a String that's too long if ( start + search [ i ] . length ( ) > bufferLen ) { continue ; } boolean found = true ; // Loop for each character in range for ( int j = 0 ; j < search [ i ] . length ( ) && ( start + j < bufferLen ) ; j ++ ) { int diff = buffer [ start + j ] - search [ i ] . charAt ( j ) ; if ( diff < 0 ) { // Since the strings are all sorted, we can abort if // the character is less than the corresponding character in // the current search string. return longestMatch ; } else if ( diff != 0 ) { found = false ; break ; } } if ( found && ( longestMatch == null || longestMatch . length ( ) < search [ i ] . length ( ) ) ) { longestMatch = search [ i ] ; } } return longestMatch ; }
Searches for any search strings in the buffer that start between the specified offsets .