nextapp.echo.filetransfer
Class ResourceDownloadProvider

java.lang.Object
  extended by nextapp.echo.filetransfer.AbstractDownloadProvider
      extended by nextapp.echo.filetransfer.ResourceDownloadProvider
All Implemented Interfaces:
java.io.Serializable, DownloadProvider

public class ResourceDownloadProvider
extends AbstractDownloadProvider

A download provider that allows the download of a resource deployed with the application.

See Also:
Serialized Form

Field Summary
protected  java.lang.String contentType
           
 
Constructor Summary
ResourceDownloadProvider(java.lang.String resourceName, java.lang.String contentType)
          Creates a new ResourceDownloadProvider to download the specified resource.
 
Method Summary
 java.lang.String getContentType()
          Returns the content type of the file.
 java.lang.String getFileName()
          Returns the file name of the resource based on the resource name.
 boolean isFileNameProvided()
          Returns true if the file name will be provided (based on the resource name).
 void setFileNameProvided(boolean fileNameProvided)
          Sets whether the file name will be provided (based on the resouce name).
 void writeFile(java.io.OutputStream out)
          Writes the file to the specified output stream.
 
Methods inherited from class nextapp.echo.filetransfer.AbstractDownloadProvider
getSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contentType

protected java.lang.String contentType
Constructor Detail

ResourceDownloadProvider

public ResourceDownloadProvider(java.lang.String resourceName,
                                java.lang.String contentType)
Creates a new ResourceDownloadProvider to download the specified resource.

Parameters:
resourceName - The name of the resource to download.
contentType - the content type of the resource.
Method Detail

getContentType

public java.lang.String getContentType()
Description copied from interface: DownloadProvider
Returns the content type of the file.

Returns:
The content type of the file.
See Also:
DownloadProvider.getContentType()

getFileName

public java.lang.String getFileName()
Returns the file name of the resource based on the resource name. Null will be returned if the FileNameProvided flag has been set to false.

Specified by:
getFileName in interface DownloadProvider
Overrides:
getFileName in class AbstractDownloadProvider
Returns:
The file's name.
See Also:
DownloadProvider.getFileName()

isFileNameProvided

public boolean isFileNameProvided()
Returns true if the file name will be provided (based on the resource name).

Returns:
True if the file name will be provided (based on the resource name).

setFileNameProvided

public void setFileNameProvided(boolean fileNameProvided)
Sets whether the file name will be provided (based on the resouce name).

Parameters:
fileNameProvided - True if the file name should be provided.

writeFile

public void writeFile(java.io.OutputStream out)
               throws java.io.IOException
Description copied from interface: DownloadProvider
Writes the file to the specified output stream.

Parameters:
out - The output stream to which the file should be written.
Throws:
java.io.IOException - If the provider is unable to perform this operation.
See Also:
DownloadProvider.writeFile(OutputStream)