question: @ SuppressWarnings ( "fallthrough" ) private int findHeaderEnd ( byte [ ] bs ) { boolean newline = true ; int len = bs . length ; for ( int i = 0 ; i < len ; i ++ ) { switch ( bs [ i ] ) { case '\r' : if ( i < len - 1 && bs [ i + 1 ] == '\n' ) i ++ ; case '\n' : if ( newline ) return i + 1 ; newline = true ; break ; default : newline = false ; } } return len ; }
target:  Find the length of header inside bs. The header is a multiple (>=0) lines of attributes plus an empty line. The empty line is included in the header.