Here you can find the source of writeString(String s, DataOutputStream out)
public static void writeString(String s, DataOutputStream out) throws IOException
//package com.java2s; import java.io.DataOutputStream; import java.io.IOException; public class Main { public static void writeString(String s, DataOutputStream out) throws IOException { if (s != null) { out.write(1);/*from www . j av a 2s. c o m*/ out.writeUTF(s); } else { out.write(0); } } }