Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.http.impl.client.cache
Class FileResourceFactory

    java.lang.Object
      org.apache.http.impl.client.cache.FileResourceFactory

All Implemented Interfaces:
  ResourceFactory

    @Immutable
    public class FileResourceFactory

extends Object
implements ResourceFactory

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

Since:
  4.1

Constructor Summary
`FileResourceFactory(File cacheDir)`

Method Summary
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### FileResourceFactory

    public FileResourceFactory(File cacheDir)

Method Detail

### generate

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

  Description copied from interface: `ResourceFactory`
  Creates a `Resource` from a given response body.

  Specified by:
    `generate` in interface `ResourceFactory`
  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`

### copy

    public Resource copy(String requestId,
                         Resource resource)
                  throws IOException

  Description copied from interface: `ResourceFactory`
  Clones an existing `Resource`.

  Specified by:
    `copy` in interface `ResourceFactory`
  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`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 1999-2013 The Apache Software Foundation. All Rights Reserved.