code: public static int writeString(DataOutput out, String s) throws IOException {
          ByteBuffer bytes = encode(s);
          int length = bytes.limit();
          WritableUtils.writeVInt(out, length);
          out.write(bytes.array(), 0, length);
          return length;
      }
docs: Write a UTF8 encoded string to out