@Contract(threading=STATELESS) public class FileResourceFactory extends Object implements ResourceFactory
Resource instances whose body is stored in a temporary file.| Constructor and Description | 
|---|
| FileResourceFactory(File cacheDir) | 
| Modifier and Type | Method and Description | 
|---|---|
| Resource | copy(String requestId,
    Resource resource)Clones an existing  Resource. | 
| Resource | generate(String requestId,
        byte[] content)Creates a  Resourcefrom a given response body. | 
| Resource | generate(String requestId,
        byte[] content,
        int off,
        int len)Creates a  Resourcefrom a given response body. | 
public FileResourceFactory(File cacheDir)
public Resource generate(String requestId, byte[] content, int off, int len) throws ResourceIOException
ResourceFactoryResource from a given response body.generate in interface ResourceFactoryrequestId - 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.Resource containing however much of
   the response body was successfully read.ResourceIOExceptionpublic Resource generate(String requestId, byte[] content) throws ResourceIOException
ResourceFactoryResource from a given response body.generate in interface ResourceFactoryrequestId - a unique identifier for this particular response body.content - byte array that represents the origin HTTP response body.Resource containing however much of
   the response body was successfully read.ResourceIOExceptionpublic Resource copy(String requestId, Resource resource) throws ResourceIOException
ResourceFactoryResource.copy in interface ResourceFactoryrequestId - unique identifier provided to associate
   with the cloned response body.resource - the original response body to clone.Resource copyResourceIOExceptionCopyright © 1999–2021 The Apache Software Foundation. All rights reserved.