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

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

public abstract class BinaryRequest
extends SpiceRequest<InputStream>

Abstract class used to download binaries. See SmallBinaryRequest and BigBinaryRequest

Author:
jva

Field Summary
protected  String url
           
 
Fields inherited from class com.octo.android.robospice.request.SpiceRequest
PRIORITY_HIGH, PRIORITY_LOW, PRIORITY_NORMAL
 
Constructor Summary
BinaryRequest(String url)
           
 
Method Summary
protected  String getUrl()
           
 InputStream loadDataFromNetwork()
           
abstract  InputStream processStream(int contentLength, InputStream inputStream)
          Override this method to process the stream downloaded
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
 

Field Detail

url

protected String url
Constructor Detail

BinaryRequest

public BinaryRequest(String url)
Method Detail

loadDataFromNetwork

public final InputStream loadDataFromNetwork()
                                      throws Exception
Specified by:
loadDataFromNetwork in class SpiceRequest<InputStream>
Throws:
Exception

getUrl

protected final String getUrl()

processStream

public abstract InputStream processStream(int contentLength,
                                          InputStream inputStream)
                                   throws IOException
Override this method to process the stream downloaded

Parameters:
contentLength - size of the download
inputStream - stream of the download
Returns:
an inputstream containing the download
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.