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

java.lang.Object
  extended by com.octo.android.robospice.request.SpiceRequest<android.graphics.Bitmap>
      extended by com.octo.android.robospice.request.simple.BitmapRequest
All Implemented Interfaces:
IBitmapRequest, Comparable<SpiceRequest<android.graphics.Bitmap>>

public class BitmapRequest
extends SpiceRequest<android.graphics.Bitmap>
implements IBitmapRequest

Downloads big images in size as bitmaps. All data is passed to the listener using file system.

Author:
sni

Field Summary
 
Fields inherited from class com.octo.android.robospice.request.SpiceRequest
PRIORITY_HIGH, PRIORITY_LOW, PRIORITY_NORMAL
 
Constructor Summary
BitmapRequest(String url, android.graphics.BitmapFactory.Options options, File cacheFile)
          Creates a BitmapRequest able to fetch a Bitmap from the network.
BitmapRequest(String url, File cacheFile)
          Creates a BitmapRequest able to fetch a Bitmap from the network.
BitmapRequest(String url, int width, int height, File cacheFile)
          Creates a BitmapRequest able to fetch a Bitmap from the network.
 
Method Summary
 File getCacheFile()
           
protected  String getUrl()
           
 android.graphics.Bitmap loadDataFromNetwork()
           
 void processStream(int contentLength, InputStream inputStream)
           
protected  void readBytes(InputStream in, ProgressByteProcessor processor)
          Inspired from Guava com.google.common.io.ByteStreams
 
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
 

Constructor Detail

BitmapRequest

public BitmapRequest(String url,
                     File cacheFile)
Creates a BitmapRequest able to fetch a Bitmap from the network.

Parameters:
url - the url of the bitmap to fetch.
cacheFile - a file used to store data during download.

BitmapRequest

public BitmapRequest(String url,
                     android.graphics.BitmapFactory.Options options,
                     File cacheFile)
Creates a BitmapRequest able to fetch a Bitmap from the network.

Parameters:
url - the url of the bitmap to fetch.
options - used to decode the data received from the network.
cacheFile - a file used to store data during download.

BitmapRequest

public BitmapRequest(String url,
                     int width,
                     int height,
                     File cacheFile)
Creates a BitmapRequest able to fetch a Bitmap from the network.

Parameters:
url - the url of the bitmap to fetch.
width - the requested width of the image.
height - the requested height of the image.
cacheFile - a file used to store data during download.
Method Detail

loadDataFromNetwork

public android.graphics.Bitmap loadDataFromNetwork()
                                            throws Exception
Specified by:
loadDataFromNetwork in interface IBitmapRequest
Specified by:
loadDataFromNetwork in class SpiceRequest<android.graphics.Bitmap>
Throws:
Exception

getUrl

protected final String getUrl()

getCacheFile

public File getCacheFile()
Specified by:
getCacheFile in interface IBitmapRequest

processStream

public void processStream(int contentLength,
                          InputStream inputStream)
                   throws IOException
Throws:
IOException

readBytes

protected void readBytes(InputStream in,
                         ProgressByteProcessor processor)
                  throws IOException
Inspired from Guava com.google.common.io.ByteStreams

Throws:
IOException


Copyright © 2012-2014. All Rights Reserved.