okhttp的封裝

使用單例模式返回數據 1.構造私有化 使Client唯一 節省資源 2.懶漢模式 判斷是否爲空 爲空上鎖 在此非判斷是否爲空 爲空New對象 雙重鎖 3.寫對應的方法 例如 get post downLoad upLoad 添加log攔截器 添加token攔截器 intercept:Toaken攔截  httpLoggingInterceptor Log攔截 addInterceptor添加攔截
相關文章
相關標籤/搜索