Bitmap RequestBody
时间: 2023-10-18 13:59:24 浏览: 150
bitmap
Bitmap RequestBody是一个用于将Bitmap对象转换为RequestBody对象的类。在实现中,可以通过创建一个继承自RequestBody的自定义类,并重写contentType()和writeTo()方法来实现。例如,可以创建一个名为BitmapRequestBody的类,其中包含一个Bitmap对象和一个Bitmap.CompressFormat对象。在contentType()方法中,可以根据Bitmap.CompressFormat的值来返回对应的MediaType。在writeTo()方法中,可以使用Bitmap对象的compress()方法将其压缩为字节数组,并将其写入到BufferedSink中。这样就可以将Bitmap对象转换为RequestBody对象,以便在网络请求中使用。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [Retrofit(七) BitmapCoverterFactory](https://blog.csdn.net/zjuter/article/details/116053335)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [okhttp3直接上传bitmap对象](https://blog.csdn.net/shangsxb/article/details/86622205)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文