code: protected void writeString(OutputStream out, String str) throws IOException {
          if (str == null) {
              writeInt(out, -1);
          } else if (str.isEmpty()) {
              writeInt(out, 0);
          } else {
              byte[] bs = StringSerializer.encode(str);
              writeInt(out, bs.length);
              out.write(bs);
          }
      }
docs: 写一个String
  
  @param out 输出流
  @param str 字符串
  @throws IOException 写入异常