public class UploadedFile extends FileBase
{@codecontent, contentSize, contentType, name| Constructor and Description |
|---|
UploadedFile()
上传文件
|
UploadedFile(Closeable deleteAction,
String contentType,
long contentSize,
InputStream content,
String name,
String extension)
上传文件
|
UploadedFile(File file)
上传文件
|
UploadedFile(File file,
String name)
上传文件
|
UploadedFile(File file,
String name,
String contentType)
上传文件
|
UploadedFile(String contentType,
InputStream content,
String name)
上传文件
|
UploadedFile(String contentType,
long contentSize,
InputStream content,
String name,
String extension)
基于上传输入的构建函数
|
| Modifier and Type | Method and Description |
|---|---|
void |
delete()
删除临时文件
|
InputStream |
getContent()
内容流
|
byte[] |
getContentAsBytes()
内容字节形式
|
long |
getContentSize()
内容大小
|
String |
getExtension()
扩展名(例:jpg)
|
boolean |
isEmpty()
是否为空
|
void |
transferTo(File file)
将内容流迁移到目标文件
|
void |
transferTo(OutputStream stream)
将内容流迁移到目标输出流
|
getContentType, getNamepublic UploadedFile()
public UploadedFile(File file) throws FileNotFoundException
file - 文件FileNotFoundExceptionpublic UploadedFile(File file, String name) throws FileNotFoundException
file - 文件name - 名字FileNotFoundExceptionpublic UploadedFile(File file, String name, String contentType) throws FileNotFoundException
file - 文件name - 名字FileNotFoundExceptionpublic UploadedFile(String contentType, InputStream content, String name)
contentType - 内容类型content - 内容流name - 文件名public UploadedFile(String contentType, long contentSize, InputStream content, String name, String extension)
contentType - 内容类型contentSize - 内容大小content - 内容流name - 文件名extension - 文件后缀名public UploadedFile(Closeable deleteAction, String contentType, long contentSize, InputStream content, String name, String extension)
contentType - 内容类型contentSize - 内容大小content - 内容流name - 文件名extension - 文件后缀名public String getExtension()
public InputStream getContent()
public byte[] getContentAsBytes()
throws IOException
IOExceptionpublic long getContentSize()
public void delete()
throws IOException
IOExceptionpublic boolean isEmpty()
throws IOException
IOExceptionpublic void transferTo(File file) throws IOException
file - 目标文件IOExceptionpublic void transferTo(OutputStream stream) throws IOException
stream - 目标输出流IOExceptionCopyright © 2025. All rights reserved.