com.nutiteq.net
Class NutiteqDownloadCounter

java.lang.Object
  extended by com.nutiteq.net.NutiteqDownloadCounter
All Implemented Interfaces:
DownloadCounter

public class NutiteqDownloadCounter
extends java.lang.Object
implements DownloadCounter

Default download counter used in library. For every network request adds an estimate of 100 bytes of overhead for creating the connection.


Constructor Summary
NutiteqDownloadCounter()
           
 
Method Summary
 void cacheHit(java.lang.String url, int length)
          Data for given url was retrieved from cache
 void downloadCompleted()
          Download request was completed.
 void downloaded(int dataLength)
          Notify about donwloaded bytes
 int getBytesLoadedFromCache()
           
 int getDownloadedBytes()
           
 int getNumberOfCacheHits()
           
 int getNumberOfNetworkRequests()
           
 void networkRequest(java.lang.String url)
          Successful network request has been made.
 void setNetworkListener(NetworkListener networkListener)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NutiteqDownloadCounter

public NutiteqDownloadCounter()
Method Detail

networkRequest

public void networkRequest(java.lang.String url)
Description copied from interface: DownloadCounter
Successful network request has been made.

Specified by:
networkRequest in interface DownloadCounter
Parameters:
url - request url

cacheHit

public void cacheHit(java.lang.String url,
                     int length)
Description copied from interface: DownloadCounter
Data for given url was retrieved from cache

Specified by:
cacheHit in interface DownloadCounter
Parameters:
url - request url
length - loaded data size

downloaded

public void downloaded(int dataLength)
Description copied from interface: DownloadCounter
Notify about donwloaded bytes

Specified by:
downloaded in interface DownloadCounter
Parameters:
dataLength - number of bytes downloaded

getDownloadedBytes

public int getDownloadedBytes()
Specified by:
getDownloadedBytes in interface DownloadCounter

setNetworkListener

public void setNetworkListener(NetworkListener networkListener)
Specified by:
setNetworkListener in interface DownloadCounter

downloadCompleted

public void downloadCompleted()
Description copied from interface: DownloadCounter
Download request was completed. Called after read and response processing action returns.

Specified by:
downloadCompleted in interface DownloadCounter

getNumberOfNetworkRequests

public int getNumberOfNetworkRequests()
Specified by:
getNumberOfNetworkRequests in interface DownloadCounter

getNumberOfCacheHits

public int getNumberOfCacheHits()
Specified by:
getNumberOfCacheHits in interface DownloadCounter

getBytesLoadedFromCache

public int getBytesLoadedFromCache()
Specified by:
getBytesLoadedFromCache in interface DownloadCounter