- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 04 Feb 2009 15:19:22 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/util
In directory hutz:/tmp/cvs-serv25361/org/w3c/css/util
Modified Files:
HTTPURL.java
Log Message:
added support for content-encoding gzip
Index: HTTPURL.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/util/HTTPURL.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- HTTPURL.java 6 Aug 2007 15:08:29 -0000 1.19
+++ HTTPURL.java 4 Feb 2009 15:19:20 -0000 1.20
@@ -17,6 +17,8 @@
import java.net.URL;
import java.net.URLConnection;
+import java.util.zip.GZIPInputStream;
+
/**
* @version $Revision$
* @author Philippe Le Hegaret
@@ -261,6 +263,24 @@
{
return getConnection(url, 0, ac);
}
+
+ /* more madness */
+ public static InputStream getInputStream(URLConnection uco) throws IOException {
+ InputStream orig_stream = uco.getInputStream();
+ String encoding;
+ if (orig_stream == null) {
+ return orig_stream; // let it fail elsewhere
+ }
+ encoding = uco.getContentEncoding();
+ // not set -> return
+ if (encoding == null) {
+ return orig_stream;
+ }
+ if (encoding.equalsIgnoreCase("gzip")) {
+ return new GZIPInputStream(orig_stream);
+ }
+ return orig_stream;
+ }
/**
*
*/
Received on Wednesday, 4 February 2009 15:19:31 UTC