1 4 5 package com.etymon.pjx; 6 7 import java.io.*; 8 9 13 public class PdfReference 14 extends PdfObject { 15 16 19 protected int _g; 20 21 24 protected int _n; 25 26 32 public PdfReference(int n, int g) { 33 _n = n; 34 _g = g; 35 } 36 37 public boolean equals(Object obj) { 38 39 if ( (obj == null) || ( !(obj instanceof PdfReference) ) ) { 40 return false; 41 } 42 43 PdfReference r = (PdfReference)obj; 44 return ( (_n == r._n) && (_g == r._g) ); 45 } 46 47 51 public int getGenerationNumber() { 52 return _g; 53 } 54 55 59 public int getObjectNumber() { 60 return _n; 61 } 62 63 public int hashCode() { 64 return _n + (_g << 16); 65 } 66 67 protected int writePdf(PdfWriter w, boolean spacing) throws IOException { 68 69 DataOutputStream dos = w.getDataOutputStream(); 70 71 int count; 72 73 if (spacing) { 74 dos.write(' '); 75 count = 1; 76 } else { 77 count = 0; 78 } 79 80 String s = Integer.toString(_n); 81 dos.writeBytes(s); 82 count += s.length(); 83 84 dos.write(' '); 85 count++; 86 87 s = Integer.toString(_g); 88 dos.writeBytes(s); 89 count += s.length(); 90 91 dos.writeBytes(" R"); 92 return count + 2; 93 94 } 95 96 } 97 | Popular Tags |