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 package org.apache.pdfbox.pdmodel.interactive.action.type; 18 19 import org.apache.pdfbox.cos.COSBase; 20 import org.apache.pdfbox.cos.COSDictionary; 21 import org.apache.pdfbox.pdmodel.common.COSObjectable; 22 23 /** 24 * This is the implementation of an URI dictionary. 25 * 26 * @version $Revision: 1.0 $ 27 * 28 */ 29 public class PDURIDictionary implements COSObjectable 30 { 31 32 private COSDictionary uriDictionary; 33 34 /** 35 * Constructor. 36 * 37 */ 38 public PDURIDictionary() 39 { 40 this.uriDictionary = new COSDictionary(); 41 } 42 43 /** 44 * Constructor. 45 * 46 * @param dictionary the corresponding dictionary 47 */ 48 public PDURIDictionary(COSDictionary dictionary) 49 { 50 this.uriDictionary = dictionary; 51 } 52 53 /** 54 * {@inheritDoc} 55 */ 56 public COSBase getCOSObject() 57 { 58 return this.uriDictionary; 59 } 60 61 /** 62 * Returns the corresponding dictionary. 63 * @return the dictionary 64 */ 65 public COSDictionary getDictionary() 66 { 67 return this.uriDictionary; 68 } 69 70 /** 71 * This will get the base URI to be used in resolving relative URI references. 72 * URI actions within the document may specify URIs in partial form, to be interpreted 73 * relative to this base address. If no base URI is specified, such partial URIs 74 * will be interpreted relative to the location of the document itself. 75 * The use of this entry is parallel to that of the body element <BASE>, as described 76 * in the HTML 4.01 Specification. 77 * 78 * @return The URI entry of the specific URI dictionary. 79 */ 80 public String getBase() 81 { 82 return this.getDictionary().getString("Base"); 83 } 84 85 /** 86 * This will set the base URI to be used in resolving relative URI references. 87 * URI actions within the document may specify URIs in partial form, to be interpreted 88 * relative to this base address. If no base URI is specified, such partial URIs 89 * will be interpreted relative to the location of the document itself. 90 * The use of this entry is parallel to that of the body element <BASE>, as described 91 * in the HTML 4.01 Specification. 92 * 93 * @param base The the base URI to be used. 94 */ 95 public void setBase(String base) 96 { 97 this.getDictionary().setString("Base", base); 98 } 99 100 }