public abstract class BaseFileUploader extends Object implements IFileUploader
Modifier and Type | Field and Description |
---|---|
protected int |
bufferSize
缓冲区大小
|
protected boolean |
fileSizeEqualOverride
文件大小相同则覆盖上传
|
protected boolean |
forceOverride
是否强制覆盖上传 (不检测文件锁定/不检测文件大小/不走断点续传)
|
protected File |
local
本地文件
|
protected FileLocks.NamedFileLock |
lock
文件锁
|
protected ByteTransferRateProgress |
progress
进度条
|
protected String |
remote
远程文件
|
protected Long |
remoteFileLength
远程文件大小 缓存
|
Modifier | Constructor and Description |
---|---|
protected |
BaseFileUploader(String remote,
File local,
String lockSuffix,
int bufferSize) |
Modifier and Type | Method and Description |
---|---|
protected void |
breakPointResume(long skip)
断点续传
|
boolean |
checkRemoteFilePresentSizeEqual()
检查远程文件存在并且大小相同
|
void |
fileSizeEqualOverride(boolean fileSizeEqualOverride)
文件大小相同则覆盖上传
|
void |
forceOverride(boolean forceOverride)
强制覆盖上传 (不检测文件锁定/不检测文件大小/不走断点续传)
|
ByteTransferRateProgress |
getProgress()
获取传输进度条
|
long |
getRemoteFileLength()
获取远程文件大小
|
protected abstract long |
getRemoteFileSize()
获取远程文件大小
|
protected abstract void |
initUpload(boolean breakPoint,
long skip)
准开始上传
|
protected void |
startUpload()
开始上传
|
protected abstract void |
transferFinish()
传输完成回调
|
protected void |
upload()
直接上传
|
protected abstract void |
write(byte[] bs,
int len)
写入
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
abort
close
protected final String remote
protected final File local
protected final FileLocks.NamedFileLock lock
protected final ByteTransferRateProgress progress
protected int bufferSize
protected boolean forceOverride
protected boolean fileSizeEqualOverride
protected Long remoteFileLength
public void forceOverride(boolean forceOverride)
IFileUploader
forceOverride
in interface IFileUploader
forceOverride
- 是否覆盖public void fileSizeEqualOverride(boolean fileSizeEqualOverride)
IFileUploader
fileSizeEqualOverride
in interface IFileUploader
fileSizeEqualOverride
- fileSizeEqualOverridepublic long getRemoteFileLength() throws IOException
IFileUploader
getRemoteFileLength
in interface IFileUploader
IOException
- IOExceptionpublic boolean checkRemoteFilePresentSizeEqual() throws IOException
IFileUploader
checkRemoteFilePresentSizeEqual
in interface IFileUploader
IOException
- IOExceptionprotected void startUpload() throws IOException
IOException
- IOExceptionprotected void upload() throws IOException
IOException
- IOExceptionprotected void breakPointResume(long skip) throws IOException
skip
- 跳过的长度IOException
- IOExceptionprotected abstract long getRemoteFileSize() throws IOException
IOException
- IOExceptionprotected abstract void initUpload(boolean breakPoint, long skip) throws IOException
breakPoint
- 是否为断点续传skip
- skipIOException
- IOExceptionprotected abstract void write(byte[] bs, int len) throws IOException
bs
- bslen
- 长度IOException
- IOExceptionprotected abstract void transferFinish() throws IOException
IOException
- IOExceptionpublic ByteTransferRateProgress getProgress()
IFileTransfer
getProgress
in interface IFileTransfer
Copyright © 2024. All rights reserved.