public static int write(String s, DataOutputStream stream) throws IOException {
    if (s == null) {
      return write(-1, stream);
    }
    int len = 0;
    byte[] bytes = s.getBytes();
    len += write(bytes.length, stream);
    stream.write(bytes);
    len += bytes.length;
    return len;
  }
write string to byteBuffer.

@return the length of string represented by byte[].
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/utils/BasicStructureSerDeUtil.java