public static class FileUploadHelper.UploadFileWrapper extends Object implements IUploadFileWrapper
Constructor and Description |
---|
UploadFileWrapper(FileItem fileItem) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
delete()
删除文件
|
byte[] |
get()
获取文件内容,将其存储在字节数组中(不适合对大文件操作)
|
String |
getContentType()
获取文件Content-Type
|
File |
getFile()
获取临时文件对象
|
InputStream |
getInputStream()
获取文件输入流对象
|
String |
getName()
获取文件名称
|
OutputStream |
getOutputStream()
获取文件输出流对象
|
String |
getPath()
获取完整的文件名及路径
|
long |
getSize()
获取文件大小
|
void |
transferTo(File dest)
转移文件
|
void |
writeTo(File file)
保存文件
|
public String getPath()
IUploadFileWrapper
getPath
in interface IUploadFileWrapper
public String getName()
IUploadFileWrapper
getName
in interface IUploadFileWrapper
public byte[] get()
public void delete()
IUploadFileWrapper
delete
in interface IUploadFileWrapper
public void transferTo(File dest) throws Exception
IUploadFileWrapper
transferTo
in interface IUploadFileWrapper
dest
- 目标Exception
- 可能产生的异常public void writeTo(File file) throws Exception
IUploadFileWrapper
writeTo
in interface IUploadFileWrapper
file
- 目标Exception
- 可能产生的异常public InputStream getInputStream() throws IOException
IUploadFileWrapper
getInputStream
in interface IUploadFileWrapper
IOException
- 可能产生的异常public long getSize()
IUploadFileWrapper
getSize
in interface IUploadFileWrapper
public File getFile() throws Exception
IUploadFileWrapper
getFile
in interface IUploadFileWrapper
Exception
- 可能产生的异常public OutputStream getOutputStream() throws IOException
IUploadFileWrapper
getOutputStream
in interface IUploadFileWrapper
IOException
- 可能产生的异常public String getContentType()
IUploadFileWrapper
getContentType
in interface IUploadFileWrapper
public void close() throws Exception
close
in interface AutoCloseable
Exception
Copyright © 2022. All rights reserved.