com.monkeycoder.monkeynetwork
Class ContentLengthContentDownloader

java.lang.Object
  extended by com.monkeycoder.monkeynetwork.ContentDownloader
      extended by com.monkeycoder.monkeynetwork.ContentLengthContentDownloader

public class ContentLengthContentDownloader
extends ContentDownloader

This ContentDownloader handles incoming data where the exact length of the content is known.

This class uses monkeynetwork.ini and requires the following parameters:

Author:
David Stephens

Field Summary
 
Fields inherited from class com.monkeycoder.monkeynetwork.ContentDownloader
hhd
 
Constructor Summary
ContentLengthContentDownloader(HttpHeaderData inHhd)
          Creates a new ContentLengthContentDownloader.
 
Method Summary
protected  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
 

Constructor Detail

ContentLengthContentDownloader

public ContentLengthContentDownloader(HttpHeaderData inHhd)
Creates a new ContentLengthContentDownloader.

Parameters:
inHhd - The header data from this request.
Method Detail

download

protected boolean download(TurboBuffer inBuffer,
                           java.io.InputStream inStream)
                    throws java.io.IOException,
                           MonkeyException
Does the actual downloading of the requested content. This version reads data from the network until it has read the number of bytes it has been told to read.

Specified by:
download in class ContentDownloader
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.