Class Downloader
java.lang.Object
uk.ac.manchester.spinnaker.protocols.download.Downloader
- All Implemented Interfaces:
AutoCloseable
public class Downloader extends Object implements AutoCloseable
Class used to manage a download. Every instance must only ever
be used from one thread.
-
Field Summary
-
Constructor Summary
Constructors Constructor Description Downloader(IPTag iptag)
Create an instance. -
Method Summary
Modifier and Type Method Description void
close()
ByteBuffer
doDownload(HasCoreLocation monitorCore, MemoryLocation address, int size)
Do the downloading.void
reuse()
Prepare to reuse the downloader.
-
Field Details
-
log
Logger for the gatherer.
-
-
Constructor Details
-
Downloader
@MustBeClosed public Downloader(IPTag iptag) throws IOException, ProcessException, InterruptedExceptionCreate an instance.- Parameters:
iptag
- The tag to reprogram to talk to this connection.- Throws:
IOException
- If IO fails.ProcessException
- If SpiNNaker rejects the reprogramming.InterruptedException
- If communications are interrupted.
-
-
Method Details
-
reuse
Prepare to reuse the downloader.- Throws:
IOException
- If IO fails.ProcessException
- If SpiNNaker rejects the reprogramming.InterruptedException
- If communications are interrupted.
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
IOException
-
doDownload
public ByteBuffer doDownload(HasCoreLocation monitorCore, MemoryLocation address, int size) throws IOException, ProcessException, InterruptedExceptionDo the downloading.- Parameters:
monitorCore
- The core to download from.address
- The address to download from.size
- The size of the download.- Returns:
- The downloaded data, or
null
if an unrecoverable error occurred. - Throws:
IOException
- If anything unexpected goes wrong.ProcessException
- If anything unexpected goes wrong.InterruptedException
- If communications are interrupted.
-