org.apache.struts.actions

Class DownloadAction.FileStreamInfo

Enclosing Class:
DownloadAction
Implemented Interfaces:
DownloadAction.StreamInfo

public static class DownloadAction.FileStreamInfo
extends java.lang.Object
implements DownloadAction.StreamInfo

A concrete implementation of the StreamInfo interface which simplifies the downloading of a file from the disk.

Field Summary

private String
contentType
The content type for this stream.
private File
file
The file to be downloaded.

Constructor Summary

FileStreamInfo(String contentType, File file)
Constructs an instance of this class, based on the supplied parameters.

Method Summary

String
getContentType()
Returns the content type of the stream to be downloaded.
InputStream
getInputStream()
Returns an input stream on the file to be downloaded.

Field Details

contentType

private String contentType
The content type for this stream.

file

private File file
The file to be downloaded.

Constructor Details

FileStreamInfo

public FileStreamInfo(String contentType,
                      File file)
Constructs an instance of this class, based on the supplied parameters.
Parameters:
contentType - The content type of the file.
file - The file to be downloaded.

Method Details

getContentType

public String getContentType()
Returns the content type of the stream to be downloaded.
Specified by:
getContentType in interface DownloadAction.StreamInfo
Returns:
The content type of the stream.

getInputStream

public InputStream getInputStream()
            throws IOException
Returns an input stream on the file to be downloaded. This stream will be closed by the DownloadAction.
Specified by:
getInputStream in interface DownloadAction.StreamInfo
Returns:
The input stream for the file to be downloaded.

Copyright B) 2000-2007 - The Apache Software Foundation