@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;
}

@ 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 ; }
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 .
