public static boolean apply ( final char [ ] [ ] robotsFilter , final URI url ) { if ( robotsFilter . length == 0 ) return true ; final String pathQuery = BURL . pathAndQuery ( url ) ; int from = 0 ; int to = robotsFilter . length - 1 ; while ( from <= to ) { final int mid = ( from + to ) >>> 1 ; final int cmp = compare ( robotsFilter [ mid ] , pathQuery ) ; if ( cmp < 0 ) from = mid + 1 ; else if ( cmp > 0 ) to = mid - 1 ; else return false ; // key found (unlikely, but possible) } return from == 0 ? true : doesNotStartsWith ( pathQuery , robotsFilter [ from - 1 ] ) ; }
Checks whether a specified URL passes a specified robots filter .