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(InputStream inputStream,
String name)
Deprecated.
use
StreamedFile(InputStream, MediaType) instead. See
MediaType.forFilename(String) for converting existing names if the
type is unknown. |
StreamedFile(InputStream inputStream,
String name,
long lastModified)
Deprecated.
use
StreamedFile(InputStream, MediaType, long) instead. See
MediaType.forFilename(String) for converting existing names if the
type is unknown. |
StreamedFile(InputStream inputStream,
String name,
long lastModified,
long contentLength)
Deprecated.
use
StreamedFile(InputStream, MediaType, long, long) instead. See
MediaType.forFilename(String) for converting existing names if the
type is unknown. |
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() |
String |
getName()
Deprecated.
|
void |
process(MutableHttpResponse<?> response)
Modify the response before it is written to the client.
|
@Deprecated public StreamedFile(InputStream inputStream, String name)
StreamedFile(InputStream, MediaType)
instead. See
MediaType.forFilename(String)
for converting existing names if the
type is unknown.inputStream
- The input streamname
- The name of the file used to determine the content type@Deprecated public StreamedFile(InputStream inputStream, String name, long lastModified)
StreamedFile(InputStream, MediaType, long)
instead. See
MediaType.forFilename(String)
for converting existing names if the
type is unknown.inputStream
- The input streamname
- the name of the file used to determine the content typelastModified
- The last modified date@Deprecated public StreamedFile(InputStream inputStream, String name, long lastModified, long contentLength)
StreamedFile(InputStream, MediaType, long, long)
instead. See
MediaType.forFilename(String)
for converting existing names if the
type is unknown.inputStream
- The input streamname
- the name of the file used to determine the content typelastModified
- The last modified datecontentLength
- the content lengthpublic 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 FileCustomizableResponseType
public long getLength()
getLength
in interface FileCustomizableResponseType
@Deprecated public String getName()
getName
in interface FileCustomizableResponseType
public MediaType getMediaType()
getMediaType
in interface FileCustomizableResponseType
public InputStream getInputStream()
public StreamedFile attach(String attachmentName)
attachmentName
- The name of the file to be attached.public void process(MutableHttpResponse<?> response)
CustomizableResponseType
process
in interface CustomizableResponseType
response
- The response to modify