mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-27 00:38:11 -07:00
Use the inputStream.
This commit is contained in:
parent
62f656fa54
commit
238a4df95b
1 changed files with 10 additions and 8 deletions
|
@ -19,7 +19,8 @@ class CountingFileRequestBody(val file: File, val contentType: String,
|
||||||
override fun contentType() = MediaType.parse(contentType)
|
override fun contentType() = MediaType.parse(contentType)
|
||||||
|
|
||||||
override fun writeTo(sink: BufferedSink) {
|
override fun writeTo(sink: BufferedSink) {
|
||||||
Okio.source(file).use { source ->
|
file.inputStream().use { fis ->
|
||||||
|
Okio.source(fis).use { source ->
|
||||||
var total = 0L
|
var total = 0L
|
||||||
var read: Long = source.read(sink.buffer(), SEGMENT_SIZE)
|
var read: Long = source.read(sink.buffer(), SEGMENT_SIZE)
|
||||||
|
|
||||||
|
@ -31,6 +32,7 @@ class CountingFileRequestBody(val file: File, val contentType: String,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// companion object {
|
// companion object {
|
||||||
// private val MEDIA_TYPE_BINARY = MediaType.parse("application/octet-stream")
|
// private val MEDIA_TYPE_BINARY = MediaType.parse("application/octet-stream")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue