Package org.apache.struts.extras.actions
Class DownloadAction.FileStreamInfo
java.lang.Object
org.apache.struts.extras.actions.DownloadAction.FileStreamInfo
- All Implemented Interfaces:
DownloadAction.StreamInfo
- Enclosing class:
DownloadAction
public static class DownloadAction.FileStreamInfo
extends Object
implements DownloadAction.StreamInfo
A concrete implementation of the
StreamInfo
interface
which simplifies the downloading of a file from the disk.-
Constructor Summary
ConstructorDescriptionFileStreamInfo
(String contentType, File file) Constructs an instance of this class, based on the supplied parameters. -
Method Summary
Modifier and TypeMethodDescriptionReturns the content type of the stream to be downloaded.Returns an input stream on the file to be downloaded.
-
Constructor Details
-
FileStreamInfo
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
Returns the content type of the stream to be downloaded.- Specified by:
getContentType
in interfaceDownloadAction.StreamInfo
- Returns:
- The content type of the stream.
-
getInputStream
Returns an input stream on the file to be downloaded. This stream will be closed by theDownloadAction
.- Specified by:
getInputStream
in interfaceDownloadAction.StreamInfo
- Returns:
- The input stream for the file to be downloaded.
- Throws:
IOException
- if an error occurs
-