org.sourcejammer.project.view
Class FileDownloader

java.lang.Object
  |
  +--org.sourcejammer.project.view.FileDownloader

public class FileDownloader
extends java.lang.Object

Title: $FileName: FileDownloader.java$

Version:
$VerNum: 3$ $KeyWordsOff: $

Object used to stream files to client is chunks of specified size.
Author:
$AuthorName: Rob MacGrogan$

Nested Class Summary
static class FileDownloader.DownloadTypes
           
 
Field Summary
private  java.io.FileInputStream downloadStream
           
private  java.io.File sendFile
           
private  boolean streamClosed
           
 
Constructor Summary
FileDownloader()
          Construct a new FileDownloader.
 
Method Summary
private  void checkSession(org.sourcejammer.project.view.DownloadFileIdentifier id)
           
private  void closeStream()
           
 org.sourcejammer.util.SendBytes downloadBytes(int iMaxBytes)
          Download the specified number of bytes packaged in a SendBytes object.
 org.sourcejammer.util.SendBytes downloadBytes(int iMaxBytes, org.sourcejammer.project.view.DownloadFileIdentifier id)
          Allows first pass through download bytes to set the file identifier to avoid an extra round trip.
 org.sourcejammer.util.SendBytes downloadFile(org.sourcejammer.project.view.DownloadFileIdentifier id)
          Should download the entire file.
private  void makeStreamIfNeeded()
           
 void setFileIdentifier(org.sourcejammer.project.view.DownloadFileIdentifier id)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sendFile

private java.io.File sendFile

downloadStream

private java.io.FileInputStream downloadStream

streamClosed

private boolean streamClosed
Constructor Detail

FileDownloader

public FileDownloader()
Construct a new FileDownloader.

Method Detail

setFileIdentifier

public void setFileIdentifier(org.sourcejammer.project.view.DownloadFileIdentifier id)
                       throws FileSendException
FileSendException

checkSession

private void checkSession(org.sourcejammer.project.view.DownloadFileIdentifier id)
                   throws FileSendException
FileSendException

downloadFile

public org.sourcejammer.util.SendBytes downloadFile(org.sourcejammer.project.view.DownloadFileIdentifier id)
                                             throws FileSendException
Should download the entire file.

FileSendException

downloadBytes

public org.sourcejammer.util.SendBytes downloadBytes(int iMaxBytes,
                                                     org.sourcejammer.project.view.DownloadFileIdentifier id)
                                              throws FileSendException
Allows first pass through download bytes to set the file identifier to avoid an extra round trip. Should only be called on 1st iterator, though probably OK if called on all iterations.

FileSendException

downloadBytes

public org.sourcejammer.util.SendBytes downloadBytes(int iMaxBytes)
                                              throws FileSendException
Download the specified number of bytes packaged in a SendBytes object.

Returns:
a SendBytes object containing the byte[] and an eof indicator.
FileSendException

closeStream

private void closeStream()
                  throws java.io.IOException
java.io.IOException

makeStreamIfNeeded

private void makeStreamIfNeeded()
                         throws java.io.IOException
java.io.IOException


Copyright © 2003 Soucejammer project.