[CB-7927] Encoding data to bytes instead of chars when writing a file.

This solves: https://issues.apache.org/jira/browse/CB-7927