Removed Unecessary write to buffer

Removed unnecessary write to the buffer since it sometimes causes out of memory exceptions and you can write the inputStream directly to the file.