日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關咨詢
選擇下列產品馬上在線溝通
服務時間:8:30-17:00
你可能遇到了下面的問題
關閉右側工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)鴻蒙OS教程:鴻蒙OSResponseCache

ResponseCache

java.lang.Object

|---java.net.ResponseCache

public abstract class ResponseCache
extends Object

表示 URLConnection 緩存的實現(xiàn)。 可以通過執(zhí)行 ResponseCache.setDefault(ResponseCache) 向系統(tǒng)注冊此類的實例,系統(tǒng)將調用此對象以:

  • 將已從外部源檢索到的資源數(shù)據(jù)存儲到緩存中
  • 嘗試獲取可能已存儲在緩存中的請求資源

ResponseCache 實現(xiàn)決定哪些資源應該被緩存,以及它們應該被緩存多長時間。 如果無法從緩存中檢索請求資源,則協(xié)議處理程序將從其原始位置獲取資源。 URLConnection#useCaches 的設置控制是否允許協(xié)議使用緩存的響應。

構造函數(shù)摘要

構造函數(shù) 描述
ResponseCache()

方法總結

修飾符和類型 方法 描述
abstract CacheResponse get(URI uri, String rqstMethod, Map> rqstHeaders) 根據(jù)請求 uri、請求方法和請求標頭檢索緩存的響應。
static ResponseCache getDefault() 獲取系統(tǒng)范圍的響應緩存。
abstract CacheRequest put(URI uri, URLConnection conn) 協(xié)議處理程序在獲取資源后調用此方法,并且 ResponseCache 必須決定是否將資源存儲在其緩存中。
static void setDefault(ResponseCache responseCache) 設置(或取消設置)系統(tǒng)范圍的緩存。
從類 java.lang.Object 繼承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

構造函數(shù)詳細信息

ResponseCache

public ResponseCache()

方法詳情

getDefault

public static ResponseCache getDefault()

獲取系統(tǒng)范圍的響應緩存。

返回:

系統(tǒng)范圍的 ResponseCache

Throws:

Throw名稱 Throw描述
SecurityException 如果已安裝安全管理器并且它拒絕 NetPermission("getResponseCache")

setDefault

public static void setDefault(ResponseCache responseCache)

設置(或取消設置)系統(tǒng)范圍的緩存。 注意:非標準協(xié)議處理程序可能會忽略此設置。

參數(shù):

參數(shù)名稱 參數(shù)描述
responseCache 響應緩存,或 null 取消設置緩存。

Throws:

Throw名稱 Throw描述
SecurityException 如果已安裝安全管理器并且它拒絕 NetPermission("setResponseCache")

get

public abstract CacheResponse get(URI uri, String rqstMethod, Map> rqstHeaders) throws IOException

根據(jù)請求 uri、請求方法和請求標頭檢索緩存的響應。 通常,此方法由協(xié)議處理程序在發(fā)出請求以獲取網(wǎng)絡資源之前調用。 如果返回緩存的響應,則使用該資源。

參數(shù):

參數(shù)名稱 參數(shù)描述
uri 用于引用請求的網(wǎng)絡資源的 URI
rqstMethod 表示請求方法的字符串
rqstHeaders - 從請求標頭字段名稱到表示當前請求標頭的字段值列表的映射

返回:

如果緩存中可用,則為 CacheResponse 實例,否則為 null

Throws:

Throw名稱 Throw描述
IOException 如果發(fā)生 I/O 錯誤
IllegalArgumentException 如果任何一個參數(shù)為空

put

public abstract CacheRequest put(URI uri, URLConnection conn) throws IOException

協(xié)議處理程序在獲取資源后調用此方法,并且 ResponseCache 必須決定是否將資源存儲在其緩存中。 如果要緩存資源,則 put() 必須返回一個 CacheRequest 對象,該對象包含協(xié)議處理程序將用于將資源寫入緩存的 OutputStream。 如果不緩存資源,則 put 必須返回 null。

參數(shù):

參數(shù)名稱 參數(shù)描述
uri 用于引用請求的網(wǎng)絡資源的 URI
conn - 用于獲取要緩存的響應的 URLConnection 實例

返回:

用于記錄要緩存的響應的 CacheRequest。 空返回表示調用者不打算緩存響應。

Throws:

Throw名稱 Throw描述
IOException 如果發(fā)生 I/O 錯誤
IllegalArgumentException 如果任何一個參數(shù)為空

文章名稱:創(chuàng)新互聯(lián)鴻蒙OS教程:鴻蒙OSResponseCache
標題網(wǎng)址:http://m.5511xx.com/article/copccjs.html