Open Chihiro23333 opened 6 years ago
你的这行代码看着很奇怪:
@Override
public FileDownloadOutputStream create(File file) throws IOException {
return new CustomFileDownloadRandomAccessFile.Creator().create(file);
}
你的实现应该参照 FileDownloadRandomAccessFile.Creator
就好了:
public static class Creator implements FileDownloadHelper.OutputStreamCreator {
@Override
public FileDownloadOutputStream create(File file) throws IOException {
return new FileDownloadRandomAccessFile(file);
}
@Override
public boolean supportSeek() {
return true;
}
}
请帖一下你 CustomFileDownloadRandomAccessFile
的实现。
现在的需求是我准备实现简单的文件加密,然后我自定义了一个输出流实现了FileDownloadOutputStream接口,也就是上面的CustomFileDownloadRandomAccessFile ,然后在write方法里面做了一些加密操作,但是现在的问题是我虽然自定义了FileDownloadOutputStream,但是运行时默认还是会走到默认的FileDownloadRandomAccessFile,CustomFileDownloadRandomAccessFile的实现和默认的FileDownloadRandomAccessFile一样,只是write方法有稍许不同,我在你的demo中也会有这个问题
不知为何自定义FileDownloadOutputStream后
使用时,不会走我自定义的FileDownloadOutputStream,还是会走默认的FileDownloadRandomAccessFile 研读了一下代码无果,希望能帮忙解决,非常感谢