NanoHttpClient_Arch
2015-09-12 16:40:57 0 举报
NanoHttpClient_Arch 是一个轻量级、高效的HTTP客户端库,专为Android平台设计。它的目标是在保持功能完整性的同时,尽可能地减小内存占用和CPU使用率。NanoHttpClient_Arch提供了丰富的API,支持GET、POST、PUT、DELETE等HTTP请求方法,以及文件上传、下载等功能。此外,它还具备良好的扩展性,可以方便地与其他库集成,如Gson、OkHttp等。NanoHttpClient_Arch的源代码简洁易懂,易于维护和修改。总之,NanoHttpClient_Arch是一个强大且实用的HTTP客户端库,适用于各种规模的Android项目。
作者其他创作
大纲/内容
OutputStream realOutputStream=IOUtils.toBufferedOutputStream(outputStream);request.onWriteRequestBody(realOutputStream);
等到了TinyHttpClient中,会考虑缓存之类了,这个类就比较有必要了
HttpConnection.createNetworkAndWriteData(IBasicRequest request)
NetworkExecutor这层可有可无,其实如果代码量不大的话,这部分代码就放到NetworkDispatcher中就可以
@Overridepublic void onWriteRequestBody(OutputStream writer) throws IOException{ if(hasDefineRequestBody()){ writeRequestBody(writer); }else if(isMultipartFormEnable()){ writeFormStreamData(writer); }else{ writeParamStreamData(writer); }}
NetworkExecutor
Data
NetworkDispatcher
...
BasicBinary
- OnUploadListener mUploadListener- String fileName- String mimeType
Binary
+ long getLength()+ void onWriteBinary(OutputStream)+ String getFileName()+ String getMimeType()
+ void run()+ void quit()
RequestQueue
Dispatcher
HttpConnection
+ attribute1:type = defaultValue+ attribute2:type- attribute3:type
Network
+ NetworkResponse performRequest(Request)
Data Interface
UrlConnectionNetwork
CacheDispatcher
File System
BasicRequest.onWriteRequestBody(OutputStream)
BasicRequest
Http(s)UrlConnection
StringRequest
JsonRequest
- HttpURLConnection
+ operation1(params):returnType- operation2(params)- operation3()
Cache
0 条评论
下一页
为你推荐
查看更多