]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Improve Filter argument construction
authorJeremias Maerki <jeremias@apache.org>
Sat, 15 Mar 2003 16:56:03 +0000 (16:56 +0000)
committerJeremias Maerki <jeremias@apache.org>
Sat, 15 Mar 2003 16:56:03 +0000 (16:56 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196102 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/pdf/PDFStream.java

index b3fbbefe90b8865de774c6f5c3728251debdc088..aa92361e7e986c2d395e9844d795c041ff47ef5f 100644 (file)
@@ -339,20 +339,24 @@ public class PDFStream extends PDFObject {
     }
 
     private String buildFilterEntries(List names) {
+        boolean needFilterEntry = false;
         StringBuffer sb = new StringBuffer();
-        sb.append("/Filter ");
-        if (names.size() > 1) {
-            sb.append("[ ");
-        }
-        for (int count = 0; count < names.size(); count++) {
-            sb.append((String)names.get(count));
-            sb.append(" ");
+        sb.append("/Filter [ ");
+        for (int i = 0; i < names.size(); i++) {
+            final String name = (String)names.get(i);
+            if (name.length() > 0) {
+                needFilterEntry = true;
+                sb.append(name);
+                sb.append(" ");
+            }
         }
-        if (names.size() > 1) {
+        if (needFilterEntry) {
             sb.append("]");
+            sb.append("\n");
+            return sb.toString();
+        } else {
+            return "";
         }
-        sb.append("\n");
-        return sb.toString();
     }
 
     private String buildDecodeParms(List parms) {