Here you can find the source of writeString(String arg, DataOutputStream data)
public static void writeString(String arg, DataOutputStream data) throws IOException
//package com.java2s; //License from project: Apache License import java.io.DataOutputStream; import java.io.IOException; public class Main { public static void writeString(String arg, DataOutputStream data) throws IOException { byte[] abyte = arg.getBytes(); data.writeInt(abyte.length);/*from w w w .j a va 2 s . c om*/ for (byte curr : abyte) data.writeByte(curr); } }