]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Bugzilla #43597:
authorJeremias Maerki <jeremias@apache.org>
Mon, 22 Oct 2007 10:12:40 +0000 (10:12 +0000)
committerJeremias Maerki <jeremias@apache.org>
Mon, 22 Oct 2007 10:12:40 +0000 (10:12 +0000)
Added support for SVGZ.
Submitted by: Max Berger <max.at.berger.name>

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@587052 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/image/analyser/ImageReaderFactory.java
src/java/org/apache/fop/image/analyser/SVGZReader.java [new file with mode: 0644]
status.xml

index b9621474f94c5a3cfdc7eb1b3c8880942ded642e..fce2d0b40f0559aeb4c839b946dbf36a7d06ed13 100644 (file)
 package org.apache.fop.image.analyser;
 
 // Java
-import java.io.InputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.util.ArrayList;
 
-// FOP
-import org.apache.fop.image.FopImage;
-import org.apache.fop.apps.FOUserAgent;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.image.FopImage;
 
 
 /**
@@ -55,6 +53,7 @@ public class ImageReaderFactory {
         // the xml parser through batik closes the stream when finished
         // so there is a workaround in the SVGReader
         registerFormat(new SVGReader());
+        registerFormat(new SVGZReader());
         registerFormat(new XMLReader());
     }
 
diff --git a/src/java/org/apache/fop/image/analyser/SVGZReader.java b/src/java/org/apache/fop/image/analyser/SVGZReader.java
new file mode 100644 (file)
index 0000000..14fde1c
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.image.analyser;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.zip.GZIPInputStream;
+
+import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.image.FopImage;
+
+/**
+ * Implements a reader for gzipped XMLFiles.
+ * 
+ * <p>
+ * The current implementation is limited to SVG files only.
+ */
+public class SVGZReader extends XMLReader {
+    /**
+     * Default constructor.
+     */
+    public SVGZReader() {
+    }
+
+    /** {@inheritDoc} */
+    protected FopImage.ImageInfo loadImage(final String uri,
+            final InputStream bis, final FOUserAgent ua) {
+        try {
+            return new SVGReader().verifySignature(uri,
+                    new GZIPInputStream(bis), ua);
+        } catch (final IOException e) {
+            // ignore
+        }
+        return null;
+    }
+}
index 70efeccb9275e054f7dad32574310e962bd0004e..975ffc2aa35b09c6064842887bab254e019f0f66 100644 (file)
@@ -28,6 +28,9 @@
 
   <changes>
     <release version="FOP Trunk">
+      <action context="Code" dev="JM" type="add" fixes-bug="43597" due-to="Max Berger">
+        Added support for SVGZ.
+      </action>
       <action context="Code" dev="JM" type="fix">
         Bugfix for NPE with empty table-row (regression from 0.93).
       </action>