jeremias    2003/03/27 02:18:05

  Modified:    src/java/org/apache/fop/pdf FlateFilter.java PDFFilter.java
                        ASCIIHexFilter.java ASCII85Filter.java
                        DCTFilter.java
  Log:
  Filters can indicate whether they are ASCII filters (which can be disabled if the 
document is encrypted)
  Filters have a new method for returning a FilteredOutputStream for the new 
on-the-fly stream output.
  
  Revision  Changes    Path
  1.2       +11 -1     xml-fop/src/java/org/apache/fop/pdf/FlateFilter.java
  
  Index: FlateFilter.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/pdf/FlateFilter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FlateFilter.java  11 Mar 2003 13:05:09 -0000      1.1
  +++ FlateFilter.java  27 Mar 2003 10:18:05 -0000      1.2
  @@ -50,6 +50,7 @@
    */ 
   package org.apache.fop.pdf;
   
  +import org.apache.fop.render.ps.FlateEncodeOutputStream;
   import org.apache.fop.util.StreamUtilities;
   
   import java.io.OutputStream;
  @@ -58,7 +59,9 @@
   import java.util.zip.DeflaterOutputStream;
   
   /**
  - * A filter to deflate a stream. Note that the attributes for
  + * A filter to deflate a stream.
  + * <p>
  + * <b>Note</b> that the attributes for
    * prediction, colors, bitsPerComponent, and columns are not supported
    * when this filter is used to handle the data compression. They are
    * only valid for externally encoded data such as that from a graphics
  @@ -267,5 +270,12 @@
           return columns;
       }
   
  +
  +    /**
  +     * @see org.apache.fop.pdf.PDFFilter#applyFilter(OutputStream)
  +     */
  +    public OutputStream applyFilter(OutputStream out) throws IOException {
  +        return new FlateEncodeOutputStream(out);
  +    }
   
   }
  
  
  
  1.2       +17 -0     xml-fop/src/java/org/apache/fop/pdf/PDFFilter.java
  
  Index: PDFFilter.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/pdf/PDFFilter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PDFFilter.java    11 Mar 2003 13:05:09 -0000      1.1
  +++ PDFFilter.java    27 Mar 2003 10:18:05 -0000      1.2
  @@ -111,6 +111,15 @@
       public abstract String getName();
   
       /**
  +     * Returns true if the filter is an ASCII filter that isn't necessary
  +     * when encryption is active.
  +     * @return boolean True if this filter is an ASCII filter
  +     */
  +    public boolean isASCIIFilter() {
  +        return false;
  +    }
  +
  +    /**
        * return a parameter dictionary for this filter, or null
        *
        * @return the decode params for the filter
  @@ -126,5 +135,13 @@
        * @throws IOException if there is an error reading or writing the data
        */
       public abstract void encode(InputStream in, OutputStream out, int length) 
throws IOException;
  +
  +    /**
  +     * Applies a filter to an OutputStream.
  +     * @param out contents to be filtered
  +     * @return OutputStream filtered contents
  +     * @throws IOException In case of an I/O problem
  +     */
  +    public abstract OutputStream applyFilter(OutputStream out) throws IOException;
   
   }
  
  
  
  1.2       +16 -0     xml-fop/src/java/org/apache/fop/pdf/ASCIIHexFilter.java
  
  Index: ASCIIHexFilter.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/pdf/ASCIIHexFilter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ASCIIHexFilter.java       11 Mar 2003 13:05:09 -0000      1.1
  +++ ASCIIHexFilter.java       27 Mar 2003 10:18:05 -0000      1.2
  @@ -56,6 +56,8 @@
   import java.io.OutputStreamWriter;
   import java.io.IOException;
   
  +import org.apache.fop.render.ps.ASCIIHexOutputStream;
  +
   /**
    * ASCII Hex filter for PDF streams.
    * This filter converts a pdf stream to ASCII hex data.
  @@ -73,6 +75,13 @@
       }
   
       /**
  +     * @see org.apache.fop.pdf.PDFFilter#isASCIIFilter()
  +     */
  +    public boolean isASCIIFilter() {
  +        return true;
  +    }
  +    
  +    /**
        * Get the decode params.
        *
        * @return always null
  @@ -101,6 +110,13 @@
           }
           writer.write(ASCIIHEX_EOD);
           writer.close();
  +    }
  +
  +    /**
  +     * @see org.apache.fop.pdf.PDFFilter#applyFilter(OutputStream)
  +     */
  +    public OutputStream applyFilter(OutputStream out) throws IOException {
  +        return new ASCIIHexOutputStream(out);
       }
   
   }
  
  
  
  1.2       +16 -0     xml-fop/src/java/org/apache/fop/pdf/ASCII85Filter.java
  
  Index: ASCII85Filter.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/pdf/ASCII85Filter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ASCII85Filter.java        11 Mar 2003 13:05:09 -0000      1.1
  +++ ASCII85Filter.java        27 Mar 2003 10:18:05 -0000      1.2
  @@ -54,6 +54,8 @@
   import java.io.InputStream;
   import java.io.IOException;
   
  +import org.apache.fop.render.ps.ASCII85OutputStream;
  +
   /**
    * PDF Filter for ASCII85.
    * This applies a filter to a pdf stream that converts
  @@ -79,6 +81,13 @@
       }
   
       /**
  +     * @see org.apache.fop.pdf.PDFFilter#isASCIIFilter()
  +     */
  +    public boolean isASCIIFilter() {
  +        return true;
  +    }
  +    
  +    /**
        * Get the decode parameters.
        *
        * @return always null
  @@ -237,6 +246,13 @@
   
   
           }
  +    }
  +
  +    /**
  +     * @see org.apache.fop.pdf.PDFFilter#applyFilter(OutputStream)
  +     */
  +    public OutputStream applyFilter(OutputStream out) throws IOException {
  +        return new ASCII85OutputStream(out);
       }
   
   }
  
  
  
  1.2       +8 -0      xml-fop/src/java/org/apache/fop/pdf/DCTFilter.java
  
  Index: DCTFilter.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/pdf/DCTFilter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DCTFilter.java    11 Mar 2003 13:05:09 -0000      1.1
  +++ DCTFilter.java    27 Mar 2003 10:18:05 -0000      1.2
  @@ -96,5 +96,13 @@
           out.close();
       }
   
  +    /**
  +     * @see org.apache.fop.pdf.PDFFilter#applyFilter(OutputStream)
  +     */
  +    public OutputStream applyFilter(OutputStream out) throws IOException {
  +        return out;
  +        //No active filtering, OutputStream is already expected to be DCT encoded
  +    }
  +
   }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to