code: public static void writeAsciiString(AsciiString s, DataOutput out) throws IOException {
          short length=(short)(s != null? s.length() : -1);
          out.writeShort(length);
          if(s != null)
              out.write(s.chars());
      }
docs: Writes an AsciiString to buf. The length of the string is written first, followed by the chars (as single-byte values).
  @param s the string
  @param out the output stream