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 java.lang.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, java.lang.String resourceType)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract java.io.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,
                                   java.lang.String resourceType)

  - ### Method Detail

    - #### minimize

          public StreamableResource minimize(StreamableResource input)
                                      throws java.io.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:
        `java.io.IOException`

    - #### doMinimize

          protected abstract java.io.InputStream doMinimize(StreamableResource resource)
                                                     throws java.io.IOException

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

    - #### isEnabled

          protected boolean isEnabled(StreamableResource resource)

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

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