org.apache.tapestry5.internal.webresources

## Class AbstractMinimizer

- java.lang.Object
- - org.apache.tapestry5.internal.webresources.AbstractMinimizer

- All Implemented Interfaces:
    ResourceMinimizer
  Direct Known Subclasses:
    CSSMinimizer, GoogleClosureMinimizer

      public abstract class AbstractMinimizer
      extends Object
      implements ResourceMinimizer

  Base class for resource minimizers.
  Since:
    5.3

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected org.slf4j.Logger` | `logger`
    `protected OperationTracker` | `tracker`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractMinimizer(org.slf4j.Logger logger, OperationTracker tracker, AssetChecksumGenerator checksumGenerator, String resourceType)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract InputStream` | `doMinimize(StreamableResource resource)` Implemented in subclasses to do the actual work.
    `protected boolean` | `isEnabled(StreamableResource resource)` Determines if the resource can be minimized.
    `StreamableResource` | `minimize(StreamableResource input)` Checks the content type of the resource and applies an appropriate minimization to it if possible.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### logger

          protected final org.slf4j.Logger logger

    - #### tracker

          protected final OperationTracker tracker

  - ### Constructor Detail

    - #### AbstractMinimizer

          public AbstractMinimizer(org.slf4j.Logger logger,
                           OperationTracker tracker,
                           AssetChecksumGenerator checksumGenerator,
                           String resourceType)

  - ### Method Detail

    - #### minimize

          public StreamableResource minimize(StreamableResource input)
                                      throws IOException

      Description copied from interface: `ResourceMinimizer`
      Checks the content type of the resource and applies an appropriate minimization to it if possible.
      Specified by:
        `minimize` in interface `ResourceMinimizer`
      Parameters:
        `input` - to minimize
      Returns:
        the same resource, or a minimized replacement for the resource
      Throws:
        `IOException`

    - #### doMinimize

          protected abstract InputStream doMinimize(StreamableResource resource)
                                             throws IOException

      Implemented in subclasses to do the actual work.
      Parameters:
        `resource` - content to minimize
      Returns:
        stream of minimized content
      Throws:
        `IOException`

    - #### isEnabled

          protected boolean isEnabled(StreamableResource resource)

      Determines if the resource can be minimized.
      Returns:
        true, subclasses may override

${project.version} - Copyright © 2003-2014 The Apache Software Foundation.