1 31 package org.pdfbox.pdfwriter; 32 33 import org.pdfbox.persistence.util.COSObjectKey; 34 35 import org.pdfbox.cos.COSBase; 36 37 44 public class COSWriterXRefEntry implements Comparable 45 { 46 private long offset; 47 private COSBase object; 48 private COSObjectKey key; 49 private boolean free = false; 50 51 52 53 56 public int compareTo(Object obj) 57 { 58 if (obj instanceof COSWriterXRefEntry) 59 { 60 return (int)(getKey().getNumber() - ((COSWriterXRefEntry)obj).getKey().getNumber()); 61 } 62 else 63 { 64 return -1; 65 } 66 } 67 72 public COSObjectKey getKey() 73 { 74 return key; 75 } 76 77 82 public long getOffset() 83 { 84 return offset; 85 } 86 87 92 public boolean isFree() 93 { 94 return free; 95 } 96 97 102 public void setFree(boolean newFree) 103 { 104 free = newFree; 105 } 106 107 112 private void setKey(COSObjectKey newKey) 113 { 114 key = newKey; 115 } 116 117 122 public void setOffset(long newOffset) 123 { 124 offset = newOffset; 125 } 126 127 134 public COSWriterXRefEntry(long start, COSBase obj, COSObjectKey keyValue) 135 { 136 super(); 137 setOffset(start); 138 setObject(obj); 139 setKey(keyValue); 140 } 141 142 147 public COSBase getObject() 148 { 149 return object; 150 } 151 152 157 private void setObject(COSBase newObject) 158 { 159 object = newObject; 160 } 161 } | Popular Tags |