public class StreamedFile extends java.lang.Object implements FileCustomizableResponseType
InputStream representing a file or resource.ATTACHMENT_HEADER| Constructor and Description |
|---|
StreamedFile(java.io.InputStream inputStream,
io.micronaut.http.MediaType mediaType) |
StreamedFile(java.io.InputStream inputStream,
io.micronaut.http.MediaType mediaType,
long lastModified) |
StreamedFile(java.io.InputStream inputStream,
io.micronaut.http.MediaType mediaType,
long lastModified,
long contentLength) |
StreamedFile(java.net.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(java.lang.String attachmentName)
Sets the file to be downloaded as an attachment.
|
java.io.InputStream |
getInputStream() |
long |
getLastModified() |
long |
getLength() |
io.micronaut.http.MediaType |
getMediaType() |
void |
process(io.micronaut.http.MutableHttpResponse<?> response)
Modify the response before it is written to the client.
|
public StreamedFile(java.io.InputStream inputStream,
io.micronaut.http.MediaType mediaType)
inputStream - The input streammediaType - The media type of the contentpublic StreamedFile(java.io.InputStream inputStream,
io.micronaut.http.MediaType mediaType,
long lastModified)
inputStream - The input streammediaType - The media type of the contentlastModified - The last modified datepublic StreamedFile(java.io.InputStream inputStream,
io.micronaut.http.MediaType mediaType,
long lastModified,
long contentLength)
inputStream - The input streammediaType - The media type of the contentlastModified - The last modified datecontentLength - the content lengthpublic StreamedFile(java.net.URL url)
url - The URL to resourcepublic long getLastModified()
getLastModified in interface FileCustomizableResponseTypepublic long getLength()
getLength in interface FileCustomizableResponseTypepublic io.micronaut.http.MediaType getMediaType()
getMediaType in interface FileCustomizableResponseTypepublic java.io.InputStream getInputStream()
public StreamedFile attach(java.lang.String attachmentName)
attachmentName - The attachment name.public void process(io.micronaut.http.MutableHttpResponse<?> response)
CustomizableResponseTypeprocess in interface CustomizableResponseTyperesponse - The response to modify