replace deprecated methods in StringBuffer