Class FileMediaReader
java.lang.Object
cool.scx.http.media.file.FileMediaReader
- All Implemented Interfaces:
MediaReader<File>
将内容写入到文件
这里不支持 复杂的写入 比如指定文件的偏移量和写入长度, 因为 用户可以拿到 ByteInput 自行操作.
- Version:
- 0.0.1
- Author:
- scx567888
-
Constructor Summary
ConstructorsConstructorDescriptionFileMediaReader(File file, boolean createDirs, OpenOption... options) FileMediaReader(File file, OpenOption... options) 默认构造, 默认创建父目录 -
Method Summary
Modifier and TypeMethodDescriptionread(cool.scx.io.ByteInput byteInput, ScxHttpHeaders headers) 读取内容
-
Constructor Details
-
FileMediaReader
默认构造, 默认创建父目录 -
FileMediaReader
- Parameters:
file- 目标文件createDirs- 如果父目录不存在, 是否自动创建options- 写入选项
-
-
Method Details
-
read
public File read(cool.scx.io.ByteInput byteInput, ScxHttpHeaders headers) throws cool.scx.io.exception.ScxIOException, cool.scx.io.exception.AlreadyClosedException Description copied from interface:MediaReader读取内容- Specified by:
readin interfaceMediaReader<File>- Parameters:
byteInput- 输入流headers- 请求头 (在客户端状态下是 responseHeaders)- Throws:
cool.scx.io.exception.ScxIOExceptioncool.scx.io.exception.AlreadyClosedException
-