info.magnolia.module.cache.util
Class GZipUtil

java.lang.Object
  extended by info.magnolia.module.cache.util.GZipUtil

public class GZipUtil
extends Object

Provide useful methods for working with gzip'd byte[]. Code originated from net.sf.ehcache.constructs.web.PageInfo under the Apache License Version 2.0.

Version:
$Revision: $ ($Author: $)

Constructor Summary
GZipUtil()
           
 
Method Summary
static byte[] gzip(byte[] ungzipped)
           
static boolean isAcceptsGzip(javax.servlet.http.HttpServletRequest request)
          True if the response should be gzipped.
static boolean isGZipMimeType(String contentType)
           
static boolean isGZipped(byte[] candidate)
          Checks the first two bytes of the candidate byte array for the magic number 0x677a.
static byte[] ungzip(byte[] gzipped)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GZipUtil

public GZipUtil()
Method Detail

gzip

public static byte[] gzip(byte[] ungzipped)
                   throws IOException
Throws:
IOException

ungzip

public static byte[] ungzip(byte[] gzipped)
                     throws IOException
Throws:
IOException

isGZipped

public static boolean isGZipped(byte[] candidate)
Checks the first two bytes of the candidate byte array for the magic number 0x677a.


isGZipMimeType

public static boolean isGZipMimeType(String contentType)

isAcceptsGzip

public static boolean isAcceptsGzip(javax.servlet.http.HttpServletRequest request)
True if the response should be gzipped. Uses the compression configuration of the cache and checks if the client accepts gzip responses.



Copyright © 2003-2011 Magnolia International Ltd.. All Rights Reserved.