Class HeapResourceFactory

  • All Implemented Interfaces:
    ResourceFactory

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

      • HeapResourceFactory

        public HeapResourceFactory()
    • Method Detail

      • generate

        public Resource generate​(java.lang.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​(java.lang.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.