I have a file(0 to N) bytes long, that i want to download and need to write it into file.
What is faster writing into FileChannel with multiple threads or writing into multiple RandomAccessFiles at the same time from each thread that is reading data from URL? Is cost of connecting each part into single file upon completion higher then writing into one FileChannel and be done at the end?
In FileChannels documentation it states
Only one operation that involves the channel's position or can change its file's size may be in progress at any given time; attempts to initiate a second such operation while the first is still in progress will block until the first operation completes.
Thats gives me a hint that writing into multiple files is faster? Or did I understand it wrong?
Does the results change when files are bigger than a few hundred megabytes?