public class DownloadedFile extends Object
| 构造器和说明 |
|---|
DownloadedFile() |
DownloadedFile(File file) |
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 - 内容类型content - 内容流name - 文件名public DownloadedFile(String contentType, InputStream content, String name)
public DownloadedFile(File file) throws FileNotFoundException
public 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.