public class DownloadedFile extends Object
| 构造器和说明 |
|---|
DownloadedFile() |
DownloadedFile(File file)
构造函数
|
DownloadedFile(File file,
String name)
构造函数
|
DownloadedFile(String contentType,
byte[] content,
String name)
构造函数
|
DownloadedFile(String contentType,
InputStream content,
String name)
构造函数
|
DownloadedFile(String contentType,
long contentSize,
InputStream content,
String name)
构造函数
|
| 限定符和类型 | 方法和说明 |
|---|---|
DownloadedFile |
asAttachment(boolean attachment)
作为附件输出
|
InputStream |
getContent()
内容类型(有些地方会动态构建,所以不能只读)
|
long |
getContentSize()
内容大小
|
String |
getContentType()
内容流
|
String |
getName()
文件名(带扩展名,例:demo.jpg)
|
boolean |
isAttachment()
是否附件输出
|
void |
transferTo(File file)
将内容流迁移到目标文件
|
void |
transferTo(OutputStream stream)
将内容流迁移到目标输出流
|
public DownloadedFile()
public DownloadedFile(String contentType, long contentSize, InputStream content, String name)
contentType - 内容类型contentSize - 内容大小content - 内容流name - 文件名public DownloadedFile(String contentType, InputStream content, String name)
contentType - 内容类型content - 内容流name - 文件名public DownloadedFile(String contentType, byte[] content, String name)
contentType - 内容类型content - 内容流name - 文件名public DownloadedFile(File file) throws FileNotFoundException
file - 文件FileNotFoundExceptionpublic DownloadedFile(File file, String name) throws FileNotFoundException
file - 文件name - 名字FileNotFoundExceptionpublic boolean isAttachment()
public DownloadedFile asAttachment(boolean attachment)
public String getContentType()
public long getContentSize()
public InputStream getContent()
public String getName()
public void transferTo(File file) throws IOException
file - 目标文件IOExceptionpublic void transferTo(OutputStream stream) throws IOException
stream - 目标输出流IOExceptionCopyright © 2023. All rights reserved.