
I am using the stream to write content to the file.I am using write() method but my friend suggest the writeTo() method. I want to know difference between the write() and writeTo() method in java.

The writeTo() method writes the complete contents of this byte array output stream to the specified output stream argument while write() method writes the specified byte to this byte array output stream.