code: public static void writeString(String s, DataOutputStream out) throws IOException
      {
          out.writeInt(s.length());
          for (char c : s.toCharArray())
          {
              out.writeChar(c);
          }
      }
docs: 简单好用的写String方式
  
  @param s
  @param out
  @throws IOException