//혹시나 비트맵 자체를 디스크 IO 없이 레트로핏을 이용해 보낼일이 있으신 분에게 강추드립니다(성능 보장).
class BitmapRequestBody(private val bitmap: Bitmap) : RequestBody() {
override fun contentType(): MediaType? {
return "image/jpeg".toMediaType()
}
override fun writeTo(sink: BufferedSink) {
bitmap.compress(Bitmap.CompressFormat.JPEG, 99, sink.outputStream())
}
}