com.monkeycoder.monkeynetwork
Class ContentDownloader

java.lang.Object
  extended by com.monkeycoder.monkeynetwork.ContentDownloader
Direct Known Subclasses:
BlindContentDownloader, ChunkedContentDownloader, ContentLengthContentDownloader, HeaderContentDownloader

public abstract class ContentDownloader
extends java.lang.Object

Superclass for all ContentDownloaders. A ContentDownloader is a self contained system for receiving network content based on the how the server is sending it.

Author:
David Stephens

Field Summary
protected  HttpHeaderData hhd
          The response header that is associated with this download, if applicable.
 
Constructor Summary
protected ContentDownloader(HttpHeaderData inHhd)
          Creates a ContentDownloader
 
Method Summary
protected abstract  boolean download(TurboBuffer inBuffer, java.io.InputStream inStream)
          Does the actual downloading of the requested content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hhd

protected HttpHeaderData hhd
The response header that is associated with this download, if applicable. Some downloaders use parts of the information found in the header.

Constructor Detail

ContentDownloader

protected ContentDownloader(HttpHeaderData inHhd)
Creates a ContentDownloader

Parameters:
inHhd - Sets the HTTP Header for access to individual parts as needed.
Method Detail

download

protected abstract boolean download(TurboBuffer inBuffer,
                                    java.io.InputStream inStream)
                             throws java.io.IOException,
                                    MonkeyException
Does the actual downloading of the requested content. This method is fleshed out by the various ContentDownloaders to download content in specific ways. Resulting data will be placed in the supplied TurboBuffer.

Parameters:
inBuffer - The TurboBuffer into which the data will be placed.
inStream - The InputStream from which the data will be read.
Returns:
Whether or not the content has been downloaded successfully.
Throws:
java.io.IOException - If thrown by underlying code.
MonkeyException - If thrown by underlying code.