de.phleisch.app.itsucks.io
Interface DataRetriever

All Known Implementing Classes:
AbstractDataRetriever, AdvancedHttpRetriever, FileResumeRetriever, FileRetriever

public interface DataRetriever

This interface specifies an DataRetriever. DataRetriever are used to provided an extended input stream for the processor chain.

Author:
olli

Field Summary
static java.lang.Integer NOTIFICATION_PROGRESS
          This type of notification will be send if the progress changes.
static java.lang.Integer RESULT_RETRIEVAL_ABORTED
          This value is returned if the retrieval was aborted.
static java.lang.Integer RESULT_RETRIEVAL_FAILED
          This value is returned if the retrieval failed.
static java.lang.Integer RESULT_RETRIEVAL_FAILED_BUT_RETRYABLE
          This value is returned if the retrieval failed but it's retryable.
static java.lang.Integer RESULT_RETRIEVAL_NOT_STARTED_YET
          This value is returned if the download was not started yet.
static java.lang.Integer RESULT_RETRIEVAL_OK
          This value is returned if the retrieval finished without errors.
 
Method Summary
 void abort()
          Aborts the current retrieving.
 void addObserver(java.util.Observer o)
          Adds an observer to the retriever, usable to retrieve progress change events.
 void connect()
          Advise the Retriever to connect to the data source.
 void deleteObserver(java.util.Observer o)
          Deletes an registered observer.
 void disconnect()
          Disconnect from the data source.
 long getBytesRetrieved()
          Returns the count of bytes read from the data source.
 long getBytesSkipped()
          Returns the skipped bytes.
 Context getContext()
          Gets the context from this data retriever.
 DataConsumer getDataConsumer()
           
 Metadata getMetadata()
          Returns the metadata of the data source connection.
 float getProgress()
          Returns the progress in processing the data in percent.
 int getResultCode()
          Returns the internal state and result code.
 java.net.URL getUrl()
          Returns the URL which is retrieved.
 boolean isDataAvailable()
          Returns true if the data source contains any data to be read.
 void retrieve()
          Retrieves all available data and send it through the processor chain.
 void setBytesToSkip(long pBytesToSkip)
          Skip the given bytes (seek) when reading the data source.
 void setContext(Context pContext)
          Sets the context for this data retriever.
 void setDataConsumer(DataConsumer pDataConsumer)
           
 void setUrl(java.net.URL pUrl)
          Sets the URL to be retrieved.
 

Field Detail

NOTIFICATION_PROGRESS

static final java.lang.Integer NOTIFICATION_PROGRESS
This type of notification will be send if the progress changes.


RESULT_RETRIEVAL_NOT_STARTED_YET

static final java.lang.Integer RESULT_RETRIEVAL_NOT_STARTED_YET
This value is returned if the download was not started yet.


RESULT_RETRIEVAL_OK

static final java.lang.Integer RESULT_RETRIEVAL_OK
This value is returned if the retrieval finished without errors.


RESULT_RETRIEVAL_FAILED

static final java.lang.Integer RESULT_RETRIEVAL_FAILED
This value is returned if the retrieval failed.


RESULT_RETRIEVAL_FAILED_BUT_RETRYABLE

static final java.lang.Integer RESULT_RETRIEVAL_FAILED_BUT_RETRYABLE
This value is returned if the retrieval failed but it's retryable.


RESULT_RETRIEVAL_ABORTED

static final java.lang.Integer RESULT_RETRIEVAL_ABORTED
This value is returned if the retrieval was aborted.

Method Detail

setDataConsumer

void setDataConsumer(DataConsumer pDataConsumer)

getDataConsumer

DataConsumer getDataConsumer()

setContext

void setContext(Context pContext)
Sets the context for this data retriever.

Parameters:
pContext -

getContext

Context getContext()
Gets the context from this data retriever.

Returns:

getUrl

java.net.URL getUrl()
Returns the URL which is retrieved.

Returns:

setUrl

void setUrl(java.net.URL pUrl)
Sets the URL to be retrieved.

Parameters:
pUrl -

connect

void connect()
             throws java.io.IOException
Advise the Retriever to connect to the data source.

Throws:
java.io.IOException

isDataAvailable

boolean isDataAvailable()
                        throws java.io.IOException
Returns true if the data source contains any data to be read.

Returns:
Throws:
java.io.IOException

retrieve

void retrieve()
              throws java.io.IOException
Retrieves all available data and send it through the processor chain.

Throws:
java.io.IOException

disconnect

void disconnect()
                throws java.io.IOException
Disconnect from the data source.

Throws:
java.io.IOException

abort

void abort()
Aborts the current retrieving.


getBytesRetrieved

long getBytesRetrieved()
Returns the count of bytes read from the data source.

Returns:

getProgress

float getProgress()
Returns the progress in processing the data in percent.

Returns:

getResultCode

int getResultCode()
Returns the internal state and result code. Check RESULT_RETRIEVAL_* constants for possible values.

Returns:

getMetadata

Metadata getMetadata()
Returns the metadata of the data source connection.

Returns:

setBytesToSkip

void setBytesToSkip(long pBytesToSkip)
Skip the given bytes (seek) when reading the data source.

Parameters:
pBytesToSkip -

getBytesSkipped

long getBytesSkipped()
Returns the skipped bytes.

Returns:

addObserver

void addObserver(java.util.Observer o)
Adds an observer to the retriever, usable to retrieve progress change events. NOTIFICATION_PROGRESS will be sent when the progress is updated.

Parameters:
o -

deleteObserver

void deleteObserver(java.util.Observer o)
Deletes an registered observer.

Parameters:
o -


Copyright © 2008. All Rights Reserved.