writeString method used insted of outstream