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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package org.apache.pdfbox.pdmodel.common.filespecification;
19 import java.io.IOException;
21 import org.apache.pdfbox.cos.COSBase;
22 import org.apache.pdfbox.cos.COSDictionary;
23 import org.apache.pdfbox.cos.COSString;
25 import org.apache.pdfbox.pdmodel.common.COSObjectable;
28 * This represents a file specification.
30 * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
31 * @version $Revision: 1.4 $
33 public abstract class PDFileSpecification implements COSObjectable
37 * A file specfication can either be a COSString or a COSDictionary. This
38 * will create the file specification either way.
40 * @param base The cos object that describes the fs.
42 * @return The file specification for the COSBase object.
44 * @throws IOException If there is an error creating the file spec.
46 public static PDFileSpecification createFS( COSBase base ) throws IOException
48 PDFileSpecification retval = null;
51 //then simply return null
53 else if( base instanceof COSString )
55 retval = new PDSimpleFileSpecification( (COSString)base );
57 else if( base instanceof COSDictionary )
59 retval = new PDComplexFileSpecification( (COSDictionary)base );
63 throw new IOException( "Error: Unknown file specification " + base );
69 * This will get the file name.
71 * @return The file name.
73 public abstract String getFile();
76 * This will set the file name.
78 * @param file The name of the file.
80 public abstract void setFile( String file );