1 31 package org.pdfbox.cos; 32 33 import org.pdfbox.exceptions.COSVisitorException; 34 35 import java.io.IOException ; 36 37 43 public class COSObject extends COSBase 44 { 45 private COSBase baseObject; 46 private COSInteger objectNumber; 47 private COSInteger generationNumber; 48 49 56 public COSObject( COSBase object ) throws IOException 57 { 58 setObject( object ); 59 } 60 61 69 public COSBase getDictionaryObject( COSName key ) 70 { 71 COSBase retval =null; 72 if( baseObject instanceof COSDictionary ) 73 { 74 retval = ((COSDictionary)baseObject).getDictionaryObject( key ); 75 } 76 return retval; 77 } 78 79 86 public COSBase getItem( COSName key ) 87 { 88 COSBase retval =null; 89 if( baseObject instanceof COSDictionary ) 90 { 91 retval = ((COSDictionary)baseObject).getItem( key ); 92 } 93 return retval; 94 } 95 96 101 public COSBase getObject() 102 { 103 return baseObject; 104 } 105 106 113 public void setObject( COSBase object ) throws IOException 114 { 115 baseObject = object; 116 165 166 } 167 168 171 public String toString() 172 { 173 return "COSObject{" + 174 (objectNumber == null ? "unknown" : "" + objectNumber.intValue() ) + ", " + 175 (generationNumber == null ? "unknown" : "" + generationNumber.intValue() ) + 176 "}"; 177 } 178 179 182 public COSInteger getObjectNumber() 183 { 184 return objectNumber; 185 } 186 187 190 public void setObjectNumber(COSInteger objectNum) 191 { 192 objectNumber = objectNum; 193 } 194 195 198 public COSInteger getGenerationNumber() 199 { 200 return generationNumber; 201 } 202 203 206 public void setGenerationNumber(COSInteger generationNumberValue) 207 { 208 generationNumber = generationNumberValue; 209 } 210 211 218 public Object accept( ICOSVisitor visitor ) throws COSVisitorException 219 { 220 return getObject() != null ? getObject().accept( visitor ) : COSNull.NULL.accept( visitor ); 221 } 222 } | Popular Tags |