2 * Licensed to the Apache Software Foundation (ASF) under one or more
\r
3 * contributor license agreements. See the NOTICE file distributed with
\r
4 * this work for additional information regarding copyright ownership.
\r
5 * The ASF licenses this file to You under the Apache License, Version 2.0
\r
6 * (the "License"); you may not use this file except in compliance with
\r
7 * the License. You may obtain a copy of the License at
\r
9 * http://www.apache.org/licenses/LICENSE-2.0
\r
11 * Unless required by applicable law or agreed to in writing, software
\r
12 * distributed under the License is distributed on an "AS IS" BASIS,
\r
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
14 * See the License for the specific language governing permissions and
\r
15 * limitations under the License.
\r
17 package org.apache.pdfbox.pdmodel.common.filespecification;
\r
19 import java.io.IOException;
\r
21 import org.apache.pdfbox.cos.COSBase;
\r
22 import org.apache.pdfbox.cos.COSDictionary;
\r
23 import org.apache.pdfbox.cos.COSString;
\r
25 import org.apache.pdfbox.pdmodel.common.COSObjectable;
\r
28 * This represents a file specification.
\r
30 * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
\r
31 * @version $Revision: 1.4 $
\r
33 public abstract class PDFileSpecification implements COSObjectable
\r
37 * A file specfication can either be a COSString or a COSDictionary. This
\r
38 * will create the file specification either way.
\r
40 * @param base The cos object that describes the fs.
\r
42 * @return The file specification for the COSBase object.
\r
44 * @throws IOException If there is an error creating the file spec.
\r
46 public static PDFileSpecification createFS( COSBase base ) throws IOException
\r
48 PDFileSpecification retval = null;
\r
51 //then simply return null
\r
53 else if( base instanceof COSString )
\r
55 retval = new PDSimpleFileSpecification( (COSString)base );
\r
57 else if( base instanceof COSDictionary )
\r
59 retval = new PDComplexFileSpecification( (COSDictionary)base );
\r
63 throw new IOException( "Error: Unknown file specification " + base );
\r
69 * This will get the file name.
\r
71 * @return The file name.
\r
73 public abstract String getFile();
\r
76 * This will set the file name.
\r
78 * @param file The name of the file.
\r
80 public abstract void setFile( String file );
\r