private int tailingNonNewline ( char [ ] cbuf , int off , int len ) { for ( int cnt = 0 ; cnt < len ; cnt ++ ) { final int pos = off + ( len - 1 ) - cnt ; if ( cbuf [ pos ] == UNIX_NEWLINE ) { return cnt ; } if ( cbuf [ pos ] == CARRIAGE_RETURN ) { return cnt ; } // TODO: need to compare to NEWLINEC, too? } return len ; }
Count the tailing non - newline characters .