code: public void writeString(String str, String charset) throws IOException {
  
  		if (str == null) {
  			writeInt(0);
  		} else {
  			byte[] tmp;
  
  			if (ByteArrayReader.encode)
  				tmp = str.getBytes(charset);
  			else
  				tmp = str.getBytes();
  
  			writeInt(tmp.length);
  			write(tmp);
  		}
  	}
docs: Write a String to the byte array converting the bytes using the given
  character set.
  
  @param str
  @param charset
  @throws IOException