IO#write must write the encoded string when encoding is provided

IO#write must use the encoding provided to encode the string to be written.

Moved IO#write to io18.rb and io19.rb to support encoding

Added specs for IO#write to validate encoding is used when provided, and exact number of bytes are written

Added spec for IO.write to test number of bytes wirtten when encoding is provided