public static void outString(DataOutputStream dos,String s) throws IOException {
  dos.writeShort((short)s.length());
  for (int i=0; i < s.length(); i++) {
    dos.writeChar(s.charAt(i));
  }
}

public static void outString ( DataOutputStream dos , String s ) throws IOException { dos . writeShort ( ( short ) s . length ( ) ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { dos . writeChar ( s . charAt ( i ) ) ; } }
outputs a string to the given stream .
