Downloading files with Java
java
Solution
A quick look at the documentation of transferFrom:
public abstract long transferFrom(ReadableByteChannel channel, long position, long count)
WELL.
The value 1<<24 for the count (from the original question) equals 16M
I guess that's the answer to your question :-)
Problem
I've written a bit of code for downloading an episode of a webcast I do. It gets the URL of the episode and gets the place to save it. However, it only downloads up to 16MB and then automatically cancels. I'm not entirely sure what value to change to increase this. Is it possible, and could someone please point me in the right direction? Thankyou! The downloading code: ``` URL url = new URL(episode.getUrl()); ReadableByteChannel rbc = Channels.newChannel(url.openStream()); FileOutputStream fos = new FileOutputStream(episode.getLocalSave()); fos.getChannel().transferFrom(rbc, 0, 1 << 24); ```