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
IOException
public DefaultFileWrapper(File sourceFile)
public DefaultFileWrapper(String contentType, long contentLength, InputStream sourceInputStream) throws IOException
IOException
public DefaultFileWrapper(org.apache.http.HttpResponse httpResponse) throws IOException
IOException
public DefaultFileWrapper(String errMsg)
public boolean hasError()
IFileWrapper
hasError
in interface IFileWrapper
public String getErrorMsg()
IFileWrapper
getErrorMsg
in interface IFileWrapper
public String getFileName()
IFileWrapper
getFileName
in interface IFileWrapper
public String getName()
IFileWrapper
getName
in interface IFileWrapper
public String getSuffix()
IFileWrapper
getSuffix
in interface IFileWrapper
public long getContentLength()
IFileWrapper
getContentLength
in interface IFileWrapper
public String getContentType()
IFileWrapper
getContentType
in interface IFileWrapper
public InputStream getInputStream() throws IOException
IFileWrapper
getInputStream
in interface IFileWrapper
IOException
- 可能产生的异常public File getFile()
IFileWrapper
getFile
in interface IFileWrapper
public void writeTo(File distFile) throws IOException
IFileWrapper
writeTo
in interface IFileWrapper
distFile
- 目标文件IOException
- 可能产生的异常public org.apache.http.entity.mime.content.ContentBody toContentBody() throws IOException
IFileWrapper
toContentBody
in interface IFileWrapper
IOException
- 可能产生的异常public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2022. All rights reserved.