Examples of CssCompressor


Examples of at.molindo.thirdparty.com.yahoo.platform.yui.compressor.CssCompressor

  }

  public static String compress(final String toCompress) {
    final StringWriter writer = new StringWriter((int) (toCompress.length() * 0.8));
    try {
      new CssCompressor(new StringReader(toCompress)).compress(writer, 0);
    } catch (final Exception e) {
      log.warn("Could not compress merged CSS stream, using uncompressed content", e);
      return toCompress;
    }
    return writer.toString();
View Full Code Here

Examples of at.molindo.thirdparty.com.yahoo.platform.yui.compressor.CssCompressor

  public static byte[] compress(final byte[] toCompress, Charset charset) {
    ByteArrayOutputStream out = new ByteArrayOutputStream(toCompress.length);

    final OutputStreamWriter writer = new OutputStreamWriter(out);
    try {
      new CssCompressor(new InputStreamReader(new ByteArrayInputStream(toCompress), charset)).compress(writer, 0);
      writer.flush();
      writer.close();
    } catch (final Exception e) {
      log.warn("Could not compress merged CSS stream, using uncompressed content", e);
      return toCompress;
View Full Code Here

Examples of com.github.dandelion.core.asset.processor.vendor.CssCompressor

  /**
   * {@inheritDoc}
   */
  @Override
  public void doProcess(Reader reader, Writer writer, ProcessingContext processingContext) throws Exception {
    new CssCompressor(reader).compress(writer, -1);
    writer.flush();
  }
View Full Code Here

Examples of com.yahoo.platform.yui.compressor.CssCompressor

      if (null == r || null == w)
         throw new NullPointerException();
      try {
         switch (type_) {
         case CSS:
            new CssCompressor(r).compress(w, -1);
            break;
         case JS:
             new JavaScriptCompressor(r, er_).compress(w, -1, true,
                     false, false, false);
            break;
View Full Code Here

Examples of com.yahoo.platform.yui.compressor.CssCompressor

    @Override
    public void compress(Reader r, Writer w) throws Exception {
        try {
            switch (type_) {
            case CSS:
                new CssCompressor(r).compress(w, -1);
                break;
            case JS:
                new JavaScriptCompressor(r, er_).compress(w, -1, true, false, false, false);
                break;
            default:
View Full Code Here

Examples of com.yahoo.platform.yui.compressor.CssCompressor

        try {
            reader = new InputStreamReader(in, charset);
            writer = new OutputStreamWriter(out, charset);

            new CssCompressor(reader).compress(writer, 0);
        } finally {
            try {
                reader.close();
            } catch (IOException e) {
                // Swallow
View Full Code Here

Examples of com.yahoo.platform.yui.compressor.CssCompressor

   public void transform(HttpServletRewrite event, InputStream input, OutputStream output) throws IOException
   {

      // prepare input reader
      Reader reader = new InputStreamReader(input, getCharset());
      CssCompressor compressor = new CssCompressor(reader);

      // write compressed output
      OutputStreamWriter writer = new OutputStreamWriter(output, getCharset());
      compressor.compress(writer, 0);
      writer.flush();

   }
View Full Code Here

Examples of com.yahoo.platform.yui.compressor.CssCompressor

            File inputFile = new File(inputFilename);
            File outputFile = new File(outputFilename);
            in = new InputStreamReader(new FileInputStream(inputFile), minifyProperty.getCharset());
            minifyFileResult.setInputFileSize(inputFile.length());

            CssCompressor compressor = new CssCompressor(in);
            in.close();
            in = null;

            out = new OutputStreamWriter(new FileOutputStream(outputFile), minifyProperty.getCharset());
            compressor.compress(out, minifyProperty.getLineBreakPosition());
            out.flush();
            minifyFileResult.setOutputFileSize(outputFile.length());
            if (minifyProperty.isAppendLogToFile()) {
                out.append("\n/*Size: " + minifyFileResult.getInputFileSize() + "->"
                        + minifyFileResult.getOutputFileSize() + "Bytes "
View Full Code Here

Examples of com.yahoo.platform.yui.compressor.CssCompressor

        return minifyFileResult;
    }

    public void compressCssInternal(Reader in, Writer out, MinifyProperty minifyProperty) throws IOException {
        try {
            CssCompressor compressor = new CssCompressor(in);
            in.close();
            in = null;
            compressor.compress(out, minifyProperty.getLineBreakPosition());
            out.flush();
        } finally {
            IOUtils.closeQuietly(in);
            IOUtils.closeQuietly(out);
        }
View Full Code Here

Examples of com.yahoo.platform.yui.compressor.CssCompressor

    {
        Reader reader = toReader(input);

        try
        {
            new CssCompressor(reader).compress(output, -1);
        } finally
        {
            reader.close();
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.