package com.mybatis.plus.utils.rangeDownload;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.locks.ReentrantLock;
@Componentpublic classMultiPartDownLoad {private static Logger logger = LoggerFactory.getLogger(MultiPartDownLoad.class);/**
* 线程下载成功标志*/
private static int flag = 0;/**
* 服务器请求路径*/
privateString serverPath;/**
* 本地路径*/
privateString localPath;/**
* refer头*/
privateString refer;/**
* 线程计数同步辅助*/
privateCountDownLatch latch;//定长线程池
private staticExecutorService threadPool;publicMultiPartDownLoad(String serverPath, String localPath, String refer) {this.serverPath =serverPath;this.localPath =localPath;this.refer =refer;
}publicMultiPartDownLoad(String serverPath, String localPath) {this.serverPath =serverPath;this.localPath =localPath;
}publicMultiPartDownLoad() {
}publicboolean