Replaced binary stream with a StringBuffer