public class DefaultFileWrapper extends Object implements IFileWrapper
| Constructor and Description |
|---|
DefaultFileWrapper(File sourceFile) |
DefaultFileWrapper(org.apache.http.HttpResponse httpResponse) |
DefaultFileWrapper(String errMsg) |
DefaultFileWrapper(String contentType,
File sourceFile) |
DefaultFileWrapper(String contentType,
long contentLength,
InputStream sourceInputStream) |
DefaultFileWrapper(String fileName,
String contentType,
File sourceFile) |
DefaultFileWrapper(String fileName,
String contentType,
long contentLength,
InputStream sourceInputStream) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
long |
getContentLength()
获取文件长度
|
String |
getContentType()
获取文件类型
|
String |
getErrorMsg()
获取错误描述信息
|
File |
getFile()
获取文件对象
|
String |
getFileName()
获取文件名称(含扩展名称)
|
InputStream |
getInputStream()
获取文件输入流
|
String |
getName()
获取文件名称(不含扩展名称)
|
String |
getSuffix()
获取文件扩展名称
|
boolean |
hasError()
是否存在错误
|
org.apache.http.entity.mime.content.ContentBody |
toContentBody()
将文件转换为ContentBody对象
|
void |
writeTo(File distFile)
复制文件到目标文件
|
public DefaultFileWrapper(String fileName, String contentType, long contentLength, InputStream sourceInputStream) throws IOException
IOExceptionpublic DefaultFileWrapper(File sourceFile)
public DefaultFileWrapper(String contentType, long contentLength, InputStream sourceInputStream) throws IOException
IOExceptionpublic DefaultFileWrapper(org.apache.http.HttpResponse httpResponse)
throws IOException
IOExceptionpublic DefaultFileWrapper(String errMsg)
public boolean hasError()
IFileWrapperhasError in interface IFileWrapperpublic String getErrorMsg()
IFileWrappergetErrorMsg in interface IFileWrapperpublic String getFileName()
IFileWrappergetFileName in interface IFileWrapperpublic String getName()
IFileWrappergetName in interface IFileWrapperpublic String getSuffix()
IFileWrappergetSuffix in interface IFileWrapperpublic long getContentLength()
IFileWrappergetContentLength in interface IFileWrapperpublic String getContentType()
IFileWrappergetContentType in interface IFileWrapperpublic InputStream getInputStream() throws IOException
IFileWrappergetInputStream in interface IFileWrapperIOException - 可能产生的异常public File getFile()
IFileWrappergetFile in interface IFileWrapperpublic void writeTo(File distFile) throws IOException
IFileWrapperwriteTo in interface IFileWrapperdistFile - 目标文件IOException - 可能产生的异常public org.apache.http.entity.mime.content.ContentBody toContentBody()
throws IOException
IFileWrappertoContentBody in interface IFileWrapperIOException - 可能产生的异常public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2022. All rights reserved.