1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements.  See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License.  You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 /* $Id: ASCII85Filter.java 1296526 2012-03-03 00:18:45Z gadams $ */
19 
20 package org.apache.fop.pdf;
21 
22 import java.io.IOException;
23 import java.io.OutputStream;
24 
25 import org.apache.xmlgraphics.util.io.ASCII85OutputStream;
26 
27 /**
28  * PDF Filter for ASCII85.
29  * This applies a filter to a pdf stream that converts
30  * the data to ASCII.
31  */
32 public class ASCII85Filter extends PDFFilter {
33 
34     /**
35      * Get the PDF name of this filter.
36      *
37      * @return the name of the filter to be inserted into the PDF
38      */
getName()39     public String getName() {
40         return "/ASCII85Decode";
41     }
42 
43     /**
44      * {@inheritDoc}
45      */
isASCIIFilter()46     public boolean isASCIIFilter() {
47         return true;
48     }
49 
50     /**
51      * Get the decode parameters.
52      *
53      * @return always null
54      */
getDecodeParms()55     public PDFObject getDecodeParms() {
56         return null;
57     }
58 
59     /**
60      * {@inheritDoc}
61      */
applyFilter(OutputStream out)62     public OutputStream applyFilter(OutputStream out) throws IOException {
63         if (isApplied()) {
64             return out;
65         } else {
66             return new ASCII85OutputStream(out);
67         }
68     }
69 
70 }
71