kt线程和分片优化

This commit is contained in:
lushunming 2025-07-14 08:31:04 +08:00
parent da0834e46e
commit f4facd0f69
4 changed files with 5 additions and 4 deletions

View File

@ -14,6 +14,7 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import okhttp3.Response import okhttp3.Response
import org.apache.commons.lang3.StringUtils import org.apache.commons.lang3.StringUtils
import java.io.ByteArrayInputStream
import java.io.InputStream import java.io.InputStream
import java.io.SequenceInputStream import java.io.SequenceInputStream
import java.util.Vector import java.util.Vector
@ -88,8 +89,8 @@ object DownloadMT {
// 存储执行结果的List // 存储执行结果的List
val jobs = mutableListOf<Job>() val jobs = mutableListOf<Job>()
val channels = List(threadNum) { Channel<ByteArray>() }
var inputStreams = mutableListOf<InputStream>() val inputStreams = MutableList<InputStream>(threadNum) { ByteArrayInputStream( ByteArray(1024)) }
for ((index, part) in partList.withIndex()) { for ((index, part) in partList.withIndex()) {
val newRange = "bytes=" + part[0] + "-" + part[1] val newRange = "bytes=" + part[0] + "-" + part[1]

Binary file not shown.

View File

@ -1 +1 @@
5cb212c16ee71528fd75f507a5aa91d4 0fdb7b55ab057fc9f8d455bf438ec1fd

View File

@ -1,5 +1,5 @@
{ {
"spider": "https://ghproxy.net/https://raw.githubusercontent.com/lushunming/AndroidCatVodSpider/multiThreadkt/jar/custom_spider.jar;md5;5cb212c16ee71528fd75f507a5aa91d4", "spider": "https://ghproxy.net/https://raw.githubusercontent.com/lushunming/AndroidCatVodSpider/multiThreadkt/jar/custom_spider.jar;md5;0fdb7b55ab057fc9f8d455bf438ec1fd",
"lives": [ "lives": [
{ {
"name": "电视直播", "name": "电视直播",