Here you can find the source of writeString(DataOutputStream outputStream, String string)
static public void writeString(DataOutputStream outputStream, String string) throws IOException
//package com.java2s; /*/*from ww w . j a va 2s .c o m*/ * Copyright 2014. * Distributed under the terms of the GPLv3 License. * * Authors: * Clemens Zeidler <czei002@aucklanduni.ac.nz> */ import java.io.*; public class Main { static public void writeString(DataOutputStream outputStream, String string) throws IOException { outputStream.writeInt(string.getBytes().length); outputStream.write(string.getBytes()); } }