Download Android and Search Service

Transcript
matcher.group("hostname"), fileInfo.getId(),
fileInfo.getName(), account,
matcher.group("dlauth"), position);
System.out.println(downloadUrl);
connection = downloadUrl.openConnection();
InputStream downloadStream = c
onnection.getInputStream();
byte[] buffer = new byte[4 * 1024];
// Loop can be stopped by calling stopDownload() method
which set downloadIsRunning.
for (int bytes = 0; (bytes =
downloadStream.read(buffer)) > 0 && downloadIsRunning;) {
fileSaver.write(buffer, bytes);
fileInfo.getSize(),
if (listener != null) {
listener.downloadProgress(this,
fileSaver.getPosition());
}
}
if (listener != null) {
if (downloadIsRunning) {
listener.downloadFinish(this);
}
else {
listener.downloadStop(this);
}
}
downloadIsRunning = false;
This is the code that allows the application to connect the Rapidshare api, we did a buffer that
reads the answer, and the fileSaver, writes the file on the buffer.
Once the file is downloaded , it ends.
5.7.3 FILESTUBE API
The application contacts the Filestube API using the SearchMaker class.
This class connects the API using again the HttpRetriever explained before, and it evaluates
the answer using the parsers. This is because the API returns a XML text in his answer.
-65-