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
return "/ASCII85Decode";
}
+ /**
+ * @see org.apache.fop.pdf.PDFFilter#isASCIIFilter()
+ */
+ public boolean isASCIIFilter() {
+ return true;
+ }
+
/**
* Get the decode parameters.
*
}
}
+ /**
+ * @see org.apache.fop.pdf.PDFFilter#applyFilter(OutputStream)
+ */
+ public OutputStream applyFilter(OutputStream out) throws IOException {
+ return new ASCII85OutputStream(out);
+ }
+
}
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.
return "/ASCIIHexDecode";
}
+ /**
+ * @see org.apache.fop.pdf.PDFFilter#isASCIIFilter()
+ */
+ public boolean isASCIIFilter() {
+ return true;
+ }
+
/**
* Get the decode params.
*
writer.close();
}
+ /**
+ * @see org.apache.fop.pdf.PDFFilter#applyFilter(OutputStream)
+ */
+ public OutputStream applyFilter(OutputStream out) throws IOException {
+ return new ASCIIHexOutputStream(out);
+ }
+
}
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
+ }
+
}
*/
package org.apache.fop.pdf;
+import org.apache.fop.render.ps.FlateEncodeOutputStream;
import org.apache.fop.util.StreamUtilities;
import java.io.OutputStream;
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
}
+ /**
+ * @see org.apache.fop.pdf.PDFFilter#applyFilter(OutputStream)
+ */
+ public OutputStream applyFilter(OutputStream out) throws IOException {
+ return new FlateEncodeOutputStream(out);
+ }
+
}
*/
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
*
*/
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;
+
}