org.jets3t.service.multi
Class DownloadPackage

java.lang.Object
  extended by org.jets3t.service.multi.DownloadPackage
Direct Known Subclasses:
DownloadPackage

public class DownloadPackage
extends java.lang.Object

A simple container object to associate a StorageObject with an output file or output stream to which the object's data will be written.

Author:
James Murty

Constructor Summary
DownloadPackage(StorageObject object, java.io.File outputFile)
           
DownloadPackage(StorageObject object, java.io.File outputFile, boolean isUnzipping, EncryptionUtil encryptionUtil)
           
DownloadPackage(StorageObject object, java.io.OutputStream outputStream)
           
DownloadPackage(StorageObject object, java.io.OutputStream outputStream, boolean isUnzipping, EncryptionUtil encryptionUtil)
           
 
Method Summary
 java.io.File getDataFile()
           
 StorageObject getObject()
           
 java.io.OutputStream getOutputStream()
          Creates an output stream to receive the object's data.
 boolean isAppendToFile()
           
 void setAppendToFile(boolean appendToFile)
          Data will be appended to the target file instead of overwriting it.
 void setObject(StorageObject object)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DownloadPackage

public DownloadPackage(StorageObject object,
                       java.io.File outputFile)

DownloadPackage

public DownloadPackage(StorageObject object,
                       java.io.File outputFile,
                       boolean isUnzipping,
                       EncryptionUtil encryptionUtil)

DownloadPackage

public DownloadPackage(StorageObject object,
                       java.io.OutputStream outputStream)

DownloadPackage

public DownloadPackage(StorageObject object,
                       java.io.OutputStream outputStream,
                       boolean isUnzipping,
                       EncryptionUtil encryptionUtil)
Method Detail

getObject

public StorageObject getObject()

setObject

public void setObject(StorageObject object)

getDataFile

public java.io.File getDataFile()
Returns:
the target output file for data, or null if this package has an output stream as its target.

isAppendToFile

public boolean isAppendToFile()

setAppendToFile

public void setAppendToFile(boolean appendToFile)
Data will be appended to the target file instead of overwriting it. This option is relevant only for packages with a target file, not those with a target output stream.

Parameters:
appendToFile -

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.lang.Exception
Creates an output stream to receive the object's data. The output stream is either the output stream provided to this package in its constructor, or an automatically-created FileOutputStream if a File object was provided as the target output object. The output stream will also be wrapped in a GZipInflatingOutputStream if isUnzipping is true and/or a decrypting output stream if this package has an associated non-null EncryptionUtil.

Returns:
an output stream that writes data to the output target managed by this class.
Throws:
java.lang.Exception