com.google.gwt.precompress.linker

## Class PrecompressLinker

- java.lang.Object
- - com.google.gwt.core.ext.Linker
  - - com.google.gwt.core.ext.linker.AbstractLinker
    - - com.google.gwt.precompress.linker.PrecompressLinker

-     @Shardable
       @LinkerOrder(value=POST)
      public class PrecompressLinker
      extends AbstractLinker

  A linker that precompresses the public artifacts that it sees. That way, a web server that uses gzip transfer encoding can use the precompressed files instead of having to compress them on the fly.

  To use this linker, add the following to your module definition:

         <inherits name="com.google.gwt.precompress.Precompress"/>

  The files to precompress are specified by the configuration property `precompress.path.regexes`. By default, the uncompressed artifacts are left in the artifact set. If the configuration property `precompress.leave.originals` is set to `false`, however, then the uncompressed version is removed.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PrecompressLinker()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getDescription()` Returns a human-readable String describing the Linker.
    `ArtifactSet` | `link(TreeLogger logger, LinkerContext context, ArtifactSet artifacts, boolean onePermutation)` This method is invoked for linkers annotated with `Shardable`.

    - ### Methods inherited from class com.google.gwt.core.ext.linker.AbstractLinker

      `emitBytes, emitBytes, emitInputStream, emitInputStream, emitString, emitString, emitWithStrongName, emitWithStrongName`

    - ### Methods inherited from class com.google.gwt.core.ext.Linker

      `isShardable, link, relink, supportsDevModeInJunit`

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

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

- - ### Constructor Detail

    - #### PrecompressLinker

          public PrecompressLinker()

  - ### Method Detail

    - #### getDescription

          public java.lang.String getDescription()

      Description copied from class: `Linker`
      Returns a human-readable String describing the Linker.
      Specified by:
        `getDescription` in class `Linker`

    - #### link

          public ArtifactSet link(TreeLogger logger,
                                  LinkerContext context,
                                  ArtifactSet artifacts,
                                  boolean onePermutation)
                           throws UnableToCompleteException

      Description copied from class: `Linker`

      This method is invoked for linkers annotated with `Shardable`. It is called at two points during compilation: after the compile of each permutation, and after all compilation has finished. The `onePermutation` is `true` for a per-permutation call and `false` for a global final-link call.

      For one-permutation calls, this method is passed all artifacts generated for just the one permutation. For the global call at the end of compilation, this method sees artifacts for the whole compilation, but with two modifications intended to support builds on computer clusters:

      1. All EmittedArtifacts have been converted to BinaryEmittedArtifacts
      2. All artifacts not marked as `Transferable` have been discarded.
      Overrides:
        `link` in class `Linker`
      Parameters:
        `logger` - the TreeLogger to record to
        `context` - provides access to the Linker's environment
        `artifacts` - an unmodifiable view of the artifacts to link
        `onePermutation` - true for a one-permutation call
      Returns:
        the artifacts that should be propagated through the linker chain
      Throws:
        `UnableToCompleteException` - if compilation violates assumptions made by the Linker or for errors encountered by the Linker