Filters have a new method for returning a FilteredOutputStream for the new on-the-fly stream output. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196150 13f79535-47bb-0310-9956-ffa450edef68tags/Root_Temp_KnuthStylePageBreaking
@@ -54,6 +54,8 @@ import java.io.OutputStream; | |||
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 | |||
@@ -78,6 +80,13 @@ public class ASCII85Filter extends PDFFilter { | |||
return "/ASCII85Decode"; | |||
} | |||
/** | |||
* @see org.apache.fop.pdf.PDFFilter#isASCIIFilter() | |||
*/ | |||
public boolean isASCIIFilter() { | |||
return true; | |||
} | |||
/** | |||
* Get the decode parameters. | |||
* | |||
@@ -239,4 +248,11 @@ public class ASCII85Filter extends PDFFilter { | |||
} | |||
} | |||
/** | |||
* @see org.apache.fop.pdf.PDFFilter#applyFilter(OutputStream) | |||
*/ | |||
public OutputStream applyFilter(OutputStream out) throws IOException { | |||
return new ASCII85OutputStream(out); | |||
} | |||
} |
@@ -56,6 +56,8 @@ import java.io.Writer; | |||
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. | |||
@@ -72,6 +74,13 @@ public class ASCIIHexFilter extends PDFFilter { | |||
return "/ASCIIHexDecode"; | |||
} | |||
/** | |||
* @see org.apache.fop.pdf.PDFFilter#isASCIIFilter() | |||
*/ | |||
public boolean isASCIIFilter() { | |||
return true; | |||
} | |||
/** | |||
* Get the decode params. | |||
* | |||
@@ -103,4 +112,11 @@ public class ASCIIHexFilter extends PDFFilter { | |||
writer.close(); | |||
} | |||
/** | |||
* @see org.apache.fop.pdf.PDFFilter#applyFilter(OutputStream) | |||
*/ | |||
public OutputStream applyFilter(OutputStream out) throws IOException { | |||
return new ASCIIHexOutputStream(out); | |||
} | |||
} |
@@ -96,5 +96,13 @@ public class DCTFilter extends PDFFilter { | |||
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 | |||
} | |||
} | |||
@@ -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.io.IOException; | |||
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 | |||
@@ -268,4 +271,11 @@ public class FlateFilter extends PDFFilter { | |||
} | |||
/** | |||
* @see org.apache.fop.pdf.PDFFilter#applyFilter(OutputStream) | |||
*/ | |||
public OutputStream applyFilter(OutputStream out) throws IOException { | |||
return new FlateEncodeOutputStream(out); | |||
} | |||
} |
@@ -110,6 +110,15 @@ public abstract class PDFFilter { | |||
*/ | |||
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 | |||
* | |||
@@ -127,4 +136,12 @@ public abstract class PDFFilter { | |||
*/ | |||
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; | |||
} |