private final boolean sniff ( byte [ ] content ) { byte [ ] beginning = content ; if ( content . length > maxOffsetGuess && maxOffsetGuess > 0 ) { beginning = Arrays . copyOfRange ( content , 0 , maxOffsetGuess ) ; } int position = Bytes . indexOf ( beginning , clue ) ; if ( position != - 1 ) { return true ; } return false ; }
Examines the first bytes of the content for a clue of whether this document is a sitemap based on namespaces . Works for XML and non - compressed documents only .