code: public static void writeStringAsText(DataOutput stream, String str) throws IOException {
      byte[] utf8Encoded = str.getBytes(StandardCharsets.UTF_8);
      writeVLong(stream, utf8Encoded.length);
      stream.write(utf8Encoded);
    }
docs: Serialize a String using the same logic as a Hadoop Text object