Here you can find the source of serializeString(String str, DataOutputStream dout)
public static void serializeString(String str, DataOutputStream dout) throws IOException
//package com.java2s; import java.io.*; public class Main { private static String tagNull = "Null"; private static String tagString = "String"; public static void serializeString(String str, DataOutputStream dout) throws IOException { if (str == null) serializeNull(dout);//from w w w . j a va2 s . c om else { serializeHeaderString(tagString, dout); dout.writeUTF(str); serializeTrailerString(tagString, dout); } } private static void serializeNull(DataOutputStream dout) throws IOException { serializeHeaderString(tagNull, dout); serializeTrailerString(tagNull, dout); } private static void serializeHeaderString(String str, DataOutputStream dout) throws IOException { dout.writeUTF("[" + str); } private static void serializeTrailerString(String str, DataOutputStream dout) throws IOException { // dout.writeUTF( str + "]" ); dout.writeUTF("]"); } }