Package com.quanser.quarc.target
Interface ModelDownload
public interface ModelDownload
The interface used for downloading code. Models may be downloaded
in "chunks" using this interface so that the progress of the download
may be monitored. It also allows code to be downloaded from any source,
including from a file or over the Internet.
-
Method Summary
-
Method Details
-
getCode
Called by the target to download the next chunk of code. This method should use the context object to read the nextbuffer.length
bytes of code and store them in the given buffer. It should return the number of bytes of code actually stored in the buffer. If this number is less thanbuffer.length
then the target interprets this as meaning that the end of the model code has been reached. In this case, the download will complete and the callback will not be invoked again. TheQUARCTarget.downloadModel(java.lang.String, java.lang.String, java.lang.String, com.quanser.quarc.target.ModelDownload, java.lang.Object)
method will then return with the number of bytes in total that were downloaded. If this method throws anIOException
then the download is cancelled and thedownloadModel
method also throws an IOException.- Parameters:
context
- The user-defined context passed toQUARCTarget.downloadModel(java.lang.String, java.lang.String, java.lang.String, com.quanser.quarc.target.ModelDownload, java.lang.Object)
.buffer
- The buffer in which to store the next chunk of code.- Returns:
- The number of bytes of code actually stored in the buffer.
-