public abstract class FileBase extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
protected InputStream |
content
内容流
|
protected long |
contentSize
内容大小
|
protected String |
contentType
内容类型(有些地方会动态构建,所以不能只读)
|
protected String |
name
文件名(带扩展名,例:demo.jpg)
|
| 构造器和说明 |
|---|
FileBase() |
FileBase(String contentType,
long contentSize,
InputStream content,
String name)
构造函数
|
| 限定符和类型 | 方法和说明 |
|---|---|
InputStream |
getContent()
内容流
|
long |
getContentSize()
内容大小
|
String |
getContentType()
内容类型
|
String |
getName()
文件名(带扩展名,例:demo.jpg)
|
void |
transferTo(File file)
将内容流迁移到目标文件
|
void |
transferTo(OutputStream stream)
将内容流迁移到目标输出流
|
protected InputStream content
protected String contentType
protected long contentSize
protected String name
public FileBase()
public FileBase(String contentType, long contentSize, InputStream content, String name)
contentType - 内容类型contentSize - 内容大小content - 内容流name - 文件名public InputStream getContent() throws IOException
IOExceptionpublic String getContentType()
public long getContentSize()
throws IOException
IOExceptionpublic String getName()
public void transferTo(File file) throws IOException
file - 目标文件IOExceptionpublic void transferTo(OutputStream stream) throws IOException
stream - 目标输出流IOExceptionCopyright © 2024. All rights reserved.