Class FileResourceFactory
java.lang.Object
org.apache.hc.client5.http.impl.cache.FileResourceFactory
- All Implemented Interfaces:
ResourceFactory
@Contract(threading=STATELESS)
public class FileResourceFactory
extends Object
implements ResourceFactory
Generates
Resource instances whose body is stored in a temporary file.- Since:
- 4.1
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
cacheDir
-
idgen
-
-
Constructor Details
-
FileResourceFactory
-
-
Method Details
-
generateUniqueCacheFile
-
generate
public Resource generate(String requestId, byte[] content, int off, int len) throws ResourceIOException 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. - Throws:
ResourceIOException
-
generate
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. - Throws:
ResourceIOException
-
copy
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
-