public class

FileResourceFactory

extends Object
implements ResourceFactory
java.lang.Object
   ↳ org.apache.http.impl.client.cache.FileResourceFactory

Class Overview

Generates Resource instances whose body is stored in a temporary file.

Summary

Public Constructors
FileResourceFactory(File cacheDir)
Public Methods
Resource copy(String requestId, Resource resource)
Clones an existing Resource.
Resource generate(String requestId, InputStream instream, InputLimit limit)
Creates a Resource from a given response body.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.apache.http.client.cache.ResourceFactory

Public Constructors

public FileResourceFactory (File cacheDir)

Public Methods

public Resource copy (String requestId, Resource resource)

Clones an existing Resource.

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

public Resource generate (String requestId, InputStream instream, InputLimit limit)

Creates a Resource from a given response body.

Parameters
requestId a unique identifier for this particular response body
instream the original InputStream 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 a Resource containing the data read to that point.
Returns
  • a Resource containing however much of the response body was successfully read.
Throws
IOException