Here you can find the source of writeString(String par0Str, DataOutput par1DataOutput)
private static void writeString(String par0Str, DataOutput par1DataOutput) throws IOException
//package com.java2s; import java.io.DataOutput; import java.io.IOException; public class Main { private static void writeString(String par0Str, DataOutput par1DataOutput) throws IOException { if (par0Str.length() > 32767) { throw new IOException("String too big"); } else {/* w w w. j av a 2s. c o m*/ par1DataOutput.writeShort(par0Str.length()); par1DataOutput.writeChars(par0Str); } } }