1 4 5 package com.etymon.pjx; 6 7 import java.io.*; 8 9 13 public class PdfInteger 14 extends PdfNumber { 15 16 19 protected int _n; 20 21 25 public static final PdfInteger ZERO = new PdfInteger(0); 26 27 31 public PdfInteger(int n) { 32 _n = n; 33 } 34 35 public boolean equals(Object obj) { 36 37 if ( (obj == null) || ( !(obj instanceof PdfInteger) ) ) { 38 return false; 39 } 40 41 return (_n == ((PdfInteger)obj)._n); 42 } 43 44 public int getInt() { 45 return _n; 46 } 47 48 public long getLong() { 49 return (long)_n; 50 } 51 52 public float getFloat() { 53 return (float)_n; 54 } 55 56 public int hashCode() { 57 return _n; 58 } 59 60 protected int writePdf(PdfWriter w, boolean spacing) throws IOException { 61 62 DataOutputStream dos = w.getDataOutputStream(); 63 64 int count; 65 66 if (spacing) { 67 dos.write(' '); 68 count = 1; 69 } else { 70 count = 0; 71 } 72 73 String s = Integer.toString(_n); 74 dos.writeBytes(s); 75 return count + s.length(); 76 } 77 78 } 79 | Popular Tags |