Changed write to use byte array not a File

Changed the write method to use the byte array and not a File.