public class UploadFile extends Object
Constructor and Description |
---|
UploadFile(UploadFileHeader header,
UploadSetting setting)
构造
|
Modifier and Type | Method and Description |
---|---|
void |
delete()
从磁盘或者内存中删除这个文件
|
byte[] |
getFileContent() |
InputStream |
getFileInputStream() |
String |
getFileName() |
UploadFileHeader |
getHeader() |
boolean |
isInMemory() |
boolean |
isUploaded() |
protected boolean |
processStream(MultipartRequestInputStream input)
处理上传表单流,提取出文件
|
long |
size() |
File |
write(File destination)
将上传的文件写入目标文件
写入后原临时文件会被删除 |
File |
write(String destPath)
将上传的文件写入指定的目标文件路径,自动创建文件
写入后原临时文件会被删除 |
public UploadFile(UploadFileHeader header, UploadSetting setting)
header
- 头部信息setting
- 上传设置public void delete()
public File write(String destPath) throws IOException
destPath
- 目标文件路径IOException
- IO异常public File write(File destination) throws IOException
destination
- 目标文件IOException
- IO异常public byte[] getFileContent() throws IOException
IOException
- IO异常public InputStream getFileInputStream() throws IOException
IOException
- IO异常public UploadFileHeader getHeader()
public String getFileName()
public long size()
public boolean isUploaded()
public boolean isInMemory()
protected boolean processStream(MultipartRequestInputStream input) throws IOException
input
- 上传表单的流IOException
- IO异常Copyright © 2024. All rights reserved.