file.write(string) writes a string binary safe to a file. The string may be empty - in which case nothing is written. But it must not be null.
file.write(string, int) writes only the first n bytes of the string to the file. If the string is short than that, it is written completely. This is not considered to be an error. Note that this version of write does avoid creating a copy of the substring to be written.
file.write(char) writes a single character to an open file. In essence exactly one byte is being written.
