code: public static void writeUTF8WithLength(OutputStream out, String str) throws IOException {
          byte[] s = str.getBytes(UTF8);
          writeInt4(out, s.length);
          out.write(s);
      }
docs: Writes out a 4 byte integer of the length (in bytes!) of the
  String, followed by the String (as UTF-8)