With single-threaded access please use StringBuilder instead of StringBuffer.
Repeated serialization to string and then to byte[] seems as pretty sub-optimal, as you know how many bytes are you appending, could you sum the byte-length in different variable instead?