+ /**
+ * Starts a download. Files can either be download to disk or streamed from
+ * the node. When downloading to disk you have to perform a direct disk
+ * access check for the directory you want to put the downloaded file in!
+ *
+ * @see #checkDirectDiskAccess(String, boolean, boolean)
+ * @param uri
+ * The URI to get
+ * @param filename
+ * The filename to save the data to, or <code>null</code> to
+ * retrieve the data as InputStream from the
+ * {@link DownloadResult}
+ * @param global
+ * Whether to put the download on the global queue
+ * @return A download result
+ * @throws IOException
+ * if an I/O error occurs communicating with the node
+ */
+ public HighLevelProgressCallback<DownloadResult> download(String uri, String filename, boolean global) throws IOException {
+ String identifier = generateIdentifier("download");
+ ClientGet clientGet = new ClientGet(uri, identifier, (filename == null) ? ReturnType.direct : ReturnType.disk);
+ clientGet.setGlobal(global);
+ HighLevelProgressCallback<DownloadResult> downloadCallback = new HighLevelProgressCallback<DownloadResult>(new DownloadResult(identifier));
+ downloadCallbacks.put(identifier, downloadCallback);
+ fcpConnection.sendMessage(clientGet);
+ return downloadCallback;
+ }
+