JAL-3446 UrlDownloadClient and Test
- moving download to Platform
- trivializing JavaScript method
- expanding SwingJS to allow for nio methods
Note: SwingJS preserves byte[] in the File, Path, or FileOutputStream
objects as well as in J2S._javaFileCache. Because of that, one thing you
have to look out for is stale references. In this case, we have:
temp = new Path(...);
fos = new FileOutputStream(temp.toString);
now two independent pointers both refer to the tmp file.
rbc = new
ReadableByteChannel(url.openStream());
fos.getChannel().transferFrom(rbc);
Now the bytes are in fos's channel, but they are not associated yet with
"tmp".
Files.copy(tmp, outfile);
This wasn't working in JavaScript, because Path tmp was out of date, and
so no bytes were being copied.
Working now, but still far to complicated for the simple operation of
transferring bytes from an InputStream to a File in JavaScript.