Class HeapResourceFactory

java.lang.Object
org.apache.hc.client5.http.impl.cache.HeapResourceFactory
All Implemented Interfaces:
ResourceFactory

@Contract(threading=STATELESS) public class HeapResourceFactory extends Object implements ResourceFactory
Generates Resource instances stored entirely in heap.
Since:
4.1
  • Field Details

  • Constructor Details

    • HeapResourceFactory

      public HeapResourceFactory()
  • Method Details

    • generate

      public Resource generate(String requestId, byte[] content, int off, int len)
      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.
      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 Resource containing however much of the response body was successfully read.
    • generate

      public Resource generate(String requestId, byte[] content)
      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.
      content - byte array that represents the origin HTTP response body.
      Returns:
      a Resource containing however much of the response body was successfully read.
    • copy

      public Resource copy(String requestId, Resource resource) throws ResourceIOException
      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:
      ResourceIOException