code: public void write(char[] charArray) throws IOException {
      if (charArray.length > 0) {
        byte[] encoded = SanePasswordEncoder.encodedLatin1(charArray);
        write(SaneWord.forInt(encoded.length + 1));
        write(encoded);
      }
  
      write(0);
    }
docs: Writes the given char[] to the underlying stream in SANE string format. The format is:
  
  <ul>
  <li>if the char[] is non-empty, a {@link SaneWord} representing the length of the string plus a
  null terminator</li>
  <li>if the char[] is non-empty, the bytes of the char[]</li>
  <li>unconditionally, a null terminator</li>
  </ul>
  
  @param charArray character array to be written to the stream
  @throws IOException