Class HeapResourceFactory
- java.lang.Object
-
- org.apache.hc.client5.http.impl.cache.HeapResourceFactory
-
- All Implemented Interfaces:
ResourceFactory
@Contract(threading=STATELESS) public class HeapResourceFactory extends java.lang.Object implements ResourceFactory
GeneratesResourceinstances stored entirely in heap.- Since:
- 4.1
-
-
Field Summary
Fields Modifier and Type Field Description static HeapResourceFactoryINSTANCE
-
Constructor Summary
Constructors Constructor Description HeapResourceFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Resourcecopy(java.lang.String requestId, Resource resource)Clones an existingResource.Resourcegenerate(java.lang.String requestId, byte[] content)Creates aResourcefrom a given response body.Resourcegenerate(java.lang.String requestId, byte[] content, int off, int len)Creates aResourcefrom a given response body.
-
-
-
Field Detail
-
INSTANCE
public static final HeapResourceFactory INSTANCE
-
-
Method Detail
-
generate
public Resource generate(java.lang.String requestId, byte[] content, int off, int len)
Description copied from interface:ResourceFactoryCreates aResourcefrom a given response body.- Specified by:
generatein interfaceResourceFactory- Parameters:
requestId- a unique identifier for this particular response body.content- byte array that represents the origin HTTP response body.off- the start offset in the array.len- the number of bytes to read from the array.- Returns:
- a
Resourcecontaining however much of the response body was successfully read.
-
generate
public Resource generate(java.lang.String requestId, byte[] content)
Description copied from interface:ResourceFactoryCreates aResourcefrom a given response body.- Specified by:
generatein interfaceResourceFactory- Parameters:
requestId- a unique identifier for this particular response body.content- byte array that represents the origin HTTP response body.- Returns:
- a
Resourcecontaining however much of the response body was successfully read.
-
copy
public Resource copy(java.lang.String requestId, Resource resource) throws ResourceIOException
Description copied from interface:ResourceFactoryClones an existingResource.- Specified by:
copyin interfaceResourceFactory- Parameters:
requestId- unique identifier provided to associate with the cloned response body.resource- the original response body to clone.- Returns:
- the
Resourcecopy - Throws:
ResourceIOException
-
-