com.octo.android.robospice.request.simple
Class BigBinaryRequest

java.lang.Object
  extended by com.octo.android.robospice.request.SpiceRequest<InputStream>
      extended by com.octo.android.robospice.request.simple.BinaryRequest
          extended by com.octo.android.robospice.request.simple.BigBinaryRequest
All Implemented Interfaces:
Comparable<SpiceRequest<InputStream>>

public class BigBinaryRequest
extends BinaryRequest

Downloads big images in size. All data is passed to the listener using file system. This class is meant to help download big images. If you wish to download smaller documents, you would be better using SmallBinaryRequest.

Author:
sni & jva

Field Summary
protected  File cacheFile
           
 
Fields inherited from class com.octo.android.robospice.request.simple.BinaryRequest
url
 
Fields inherited from class com.octo.android.robospice.request.SpiceRequest
PRIORITY_HIGH, PRIORITY_LOW, PRIORITY_NORMAL
 
Constructor Summary
BigBinaryRequest(String url, File cacheFile)
          Creates a BigBinaryRequest using its own cache file to prevent any downloaded data to be stored in memory.
 
Method Summary
 File getCacheFile()
           
 InputStream processStream(int contentLength, InputStream inputStream)
          Override this method to process the stream downloaded
 
Methods inherited from class com.octo.android.robospice.request.simple.BinaryRequest
getUrl, loadDataFromNetwork, readBytes
 
Methods inherited from class com.octo.android.robospice.request.SpiceRequest
cancel, compareTo, getPriority, getResultType, getRetryPolicy, isAggregatable, isCancelled, publishProgress, publishProgress, setAggregatable, setFuture, setPriority, setRequestCancellationListener, setRequestProgressListener, setRetryPolicy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cacheFile

protected File cacheFile
Constructor Detail

BigBinaryRequest

public BigBinaryRequest(String url,
                        File cacheFile)
Creates a BigBinaryRequest using its own cache file to prevent any downloaded data to be stored in memory. All file received from the network (via a simple http GET request) will be stored directly in the cache file to prevent memory loss.

Parameters:
url - the url to get the image data from.
cacheFile - a file used to store image data. Developers will have to handle the cache file erasure by themselves. This cache file is not handled by RS caching mechanism in the "normal way".
Method Detail

processStream

public InputStream processStream(int contentLength,
                                 InputStream inputStream)
                          throws IOException
Description copied from class: BinaryRequest
Override this method to process the stream downloaded

Specified by:
processStream in class BinaryRequest
Parameters:
contentLength - size of the download
inputStream - stream of the download
Returns:
an inputstream containing the download
Throws:
IOException

getCacheFile

public File getCacheFile()


Copyright © 2012-2014. All Rights Reserved.