This repository was archived by the owner on Sep 15, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
src/main/resources/template/gradle-kotlin-dsl Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 1+ import java.io.IOException
2+ import java.io.InputStream
3+ import java.io.OutputStream
4+ import java.util.*
5+
16plugins {
27 kotlin(" jvm" ) version " 1.3.71"
38 java
@@ -65,7 +70,7 @@ tasks {
6570 ?.let {
6671 println (" Coping ${it.name} " )
6772 it.inputStream()
68- .transferTo (File (" $testConsoleDir /plugins/${it.name} " ).apply { createNewFile() }
73+ .transferTo1 (File (" $testConsoleDir /plugins/${it.name} " ).apply { createNewFile() }
6974 .outputStream())
7075 println (" Copied ${it.name} " )
7176 }
@@ -83,4 +88,18 @@ tasks {
8388 args(miraiCoreVersion, miraiConsoleVersion)
8489 }
8590 }
91+ }
92+
93+
94+ @Throws(IOException ::class )
95+ fun InputStream.transferTo1 (out : OutputStream ): Long {
96+ Objects .requireNonNull(out , " out" )
97+ var transferred: Long = 0
98+ val buffer = ByteArray (8192 )
99+ var read: Int
100+ while (this .read(buffer, 0 , InputStream .DEFAULT_BUFFER_SIZE ).also { read = it } >= 0 ) {
101+ out .write(buffer, 0 , read)
102+ transferred + = read.toLong()
103+ }
104+ return transferred
86105}
You can’t perform that action at this time.
0 commit comments