Class HeapResourceFactory
- java.lang.Object
-
- org.apache.http.impl.client.cache.HeapResourceFactory
-
- All Implemented Interfaces:
ResourceFactory
@Contract(threading=IMMUTABLE) public class HeapResourceFactory extends java.lang.Object implements ResourceFactory
GeneratesResource
instances stored entirely in heap.- Since:
- 4.1
-
-
Constructor Summary
Constructors Constructor Description HeapResourceFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Resource
copy(java.lang.String requestId, Resource resource)
Clones an existingResource
.(package private) Resource
createResource(byte[] buf)
Resource
generate(java.lang.String requestId, java.io.InputStream inStream, InputLimit limit)
Creates aResource
from a given response body.
-
-
-
Method Detail
-
generate
public Resource generate(java.lang.String requestId, java.io.InputStream inStream, InputLimit limit) throws java.io.IOException
Description copied from interface:ResourceFactory
Creates aResource
from a given response body.- Specified by:
generate
in interfaceResourceFactory
- 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:
java.io.IOException
-
copy
public Resource copy(java.lang.String requestId, Resource resource) throws java.io.IOException
Description copied from interface:ResourceFactory
Clones an existingResource
.- Specified by:
copy
in interfaceResourceFactory
- Parameters:
requestId
- unique identifier provided to associate with the cloned response body.resource
- the original response body to clone.- Returns:
- the
Resource
copy - Throws:
java.io.IOException
-
createResource
Resource createResource(byte[] buf)
-
-