Package com.drake.net.body

Types

NetRequestBody
Link copied to clipboard
class NetRequestBody(body: RequestBody, progressListeners: ConcurrentLinkedQueue<ProgressListener>?) : RequestBody
NetResponseBody
Link copied to clipboard
class NetResponseBody(body: ResponseBody, progressListeners: ConcurrentLinkedQueue<ProgressListener>?, complete: () -> Unit?) : ResponseBody

Functions

isFile
Link copied to clipboard
fun MultipartBody.Part.isFile(): Boolean
通过判断okhttp3.Headers里面的Content-Disposition是否存在filename属性来确定是否为文件类型MultipartBody.Part
name
Link copied to clipboard
fun MultipartBody.Part.name(): String?
返回Content-Disposition里面的字段名称
peekBytes
Link copied to clipboard
fun RequestBody.peekBytes(byteCount: Long = 1024 * 1024): ByteString
复制一段指定长度的字符串内容
fun ResponseBody.peekBytes(byteCount: Long = 1024 * 1024 * 4): ByteString
复制一段指定长度的字符串内容
toNetRequestBody
Link copied to clipboard
fun RequestBody.toNetRequestBody(listeners: ConcurrentLinkedQueue<ProgressListener>? = null): <ERROR CLASS>
toNetResponseBody
Link copied to clipboard
fun ResponseBody.toNetResponseBody(listeners: ConcurrentLinkedQueue<ProgressListener>? = null, complete: () -> Unit? = null): <ERROR CLASS>
value
Link copied to clipboard
fun MultipartBody.Part.value(): String?
MultipartBody.Part.body作为字符串返回 如果MultipartBody.Part是文件类型则返回的是文件名称, 确定文件类型请参考MultipartBody.Part.isFile