Package org.apache.http.client.cache
Interface ResourceFactory
- All Known Implementing Classes:
FileResourceFactory
,HeapResourceFactory
public interface ResourceFactory
Generates
Resource
instances for handling cached
HTTP response bodies.- Since:
- 4.1
-
Method Summary
-
Method Details
-
generate
Creates aResource
from a given response body.- Parameters:
requestId
- a unique identifier for this particular response bodyinStream
- the originalInputStream
containing the response body of the origin HTTP response.limit
- maximum number of bytes to consume of the response body; if this limit is reached before the response body is fully consumed, mark the limit has having been reached and return aResource
containing the data read to that point.- Returns:
- a
Resource
containing however much of the response body was successfully read. - Throws:
IOException
-
copy
Clones an existingResource
.- Parameters:
requestId
- unique identifier provided to associate with the cloned response body.resource
- the original response body to clone.- Returns:
- the
Resource
copy - Throws:
IOException
-