public class StreamedFile extends Object implements FileCustomizableResponseType
InputStream representing a file or resource.ATTACHMENT_HEADER| Constructor and Description |
|---|
StreamedFile(InputStream inputStream,
MediaType mediaType) |
StreamedFile(InputStream inputStream,
MediaType mediaType,
long lastModified) |
StreamedFile(InputStream inputStream,
MediaType mediaType,
long lastModified,
long contentLength) |
StreamedFile(URL url)
Immediately opens a connection to the given URL to retrieve
data about the connection, including the input stream.
|
| Modifier and Type | Method and Description |
|---|---|
StreamedFile |
attach(String attachmentName)
Sets the file to be downloaded as an attachment.
|
InputStream |
getInputStream() |
long |
getLastModified() |
long |
getLength() |
MediaType |
getMediaType() |
void |
process(MutableHttpResponse<?> response)
Modify the response before it is written to the client.
|
public StreamedFile(InputStream inputStream, MediaType mediaType)
inputStream - The input streammediaType - The media type of the contentpublic StreamedFile(InputStream inputStream, MediaType mediaType, long lastModified)
inputStream - The input streammediaType - The media type of the contentlastModified - The last modified datepublic StreamedFile(InputStream inputStream, MediaType mediaType, long lastModified, long contentLength)
inputStream - The input streammediaType - The media type of the contentlastModified - The last modified datecontentLength - the content lengthpublic StreamedFile(URL url)
url - The URL to resourcepublic long getLastModified()
getLastModified in interface FileCustomizableResponseTypepublic long getLength()
getLength in interface FileCustomizableResponseTypepublic MediaType getMediaType()
getMediaType in interface FileCustomizableResponseTypepublic InputStream getInputStream()
public StreamedFile attach(String attachmentName)
attachmentName - The attachment name.public void process(MutableHttpResponse<?> response)
CustomizableResponseTypeprocess in interface CustomizableResponseTyperesponse - The response to modify