fixed StringOutputStream::c_str const

"c_str() const" can not flush the stream, so in some
cases no null terminator was appended when c_str() was called.
Now the null terminator is always appended by write operation.

Change-Id: I10819a89e5bdbbb2926785b16603ca06afe2d8e3